How to check if an expression is a real-valued number

Update:

 Internal`RealValuedNumericQ /@ {1, N[Pi], 1/2, Sin[1.], Pi, 3/4, aa,  I}
 (* {True, True, True, True, True, True, False, False} *)

or

 Internal`RealValuedNumberQ /@ {1, N[Pi], 1/2, Sin[1.], Pi, 3/4, aa, I}
 (* {True, True, True, True, False, True, False, False} *)

Using @RM's test list

 listRM = With[{n = 10^5},
  RandomSample[Flatten[{RandomChoice[CharacterRange["A", "z"], n],
  RandomInteger[100, n],
  RandomReal[1, n],
  RandomComplex[1, n],
  RandomInteger[100, n]/RandomInteger[{1, 100}, n],
  Unevaluated@Pause@5}], 5 n + 1]];

and his realQ

 ClearAll@realQrm
 SetAttributes[realQrm, Listable] 
 realQrm[_Real | _Integer | _Rational] := True 
 realQrm[_] := False

timings

 realQrm@listRM; // AbsoluteTiming
 (* {0.458046, Null}  *)

 Internal`RealValuedNumericQ /@ listRM; // AbsoluteTiming
 (* {0.247025, Null} *)

 Internal`RealValuedNumberQ /@ listRM; // AbsoluteTiming
 (* {0.231023, Null} *)

 realQ = NumberQ[#] && ! MatchQ[#, _Complex] &
 realQ /@ {1, N[Pi], 1/2, Sin[1.], 3/4, aa, I}
 (* {True, True, True, True, True, False, False} *)

or

realQ2 = NumericQ[#] && ! MatchQ[#, _Complex] &
realQ3 = NumericQ[#] && FreeQ[#, _Complex] &

As the responses show, there are a number of quick "probably real" tests. In general, the problem is undecidable, however. This is an easy corollary of Richardson's theorem, which says that it is impossible to decide if two real expressions $x$ and $y$ are equal. Assuming Richardson's theorem, note that $(x-y)i$ is real if and only if $x=y$.

As a more mundane example, that arises in common practice with Mathematica, consider the polynomial $p(x)=13x^3-13x-1$. It's easy to see that all three roots are real (even if they don't look it), yet they don't pass any of the test here.

roots = x /. Solve[13 x^3 - 13 x - 1 == 0, x]
Internal`RealValuedNumericQ /@ roots

enter image description here


RealQ[x_] := Element[x, Reals] === True

It fulfills all your samples and I think is generally correct.