3. Let $[x]$ denote the greatest integer not greater than the real number $x$. The number of real roots of the equation $\lg ^{2} x-[\lg x]-2=0$ is $\qquad$ .

Translate the above text into English, please retain the original text's line breaks and format, and output the translation result directly.
3. 3 .

From $[\lg x] \leqslant \lg x$, we get $\lg ^{2} x-\lg x-2 \leqslant 0$, which means $-1 \leqslant \lg x \leqslant 2$.

When $-1 \leqslant \lg x<0$, we have $[\lg x]=-1$. Substituting into the original equation, we get $\lg x= \pm 1$, but $\lg x=1$ is not valid, so $\lg x=-1, x_{1}=\frac{1}{10}$.

When $0 \leqslant \lg x<1$, we have $[\lg x]=0$, substituting into the original equation, we get $\lg x$ $= \pm \sqrt{2}$, both of which are not valid.

When $1 \leqslant \lg x<2$, we have $[\lg x]=1$, substituting into the original equation, we get $\lg x$ $= \pm \sqrt{3}$. But $\lg x=-\sqrt{3}$ is not valid, so $\lg x=\sqrt{3}, x_{2}$ $=10 \sqrt{3}$.

When $\lg x=2$, we get $x_{3}=100$.
Therefore, the original equation has
3 real roots.