RealValuedNumericQ[expr]
gives True if expr is a real-valued numeric quantity, and False otherwise.
RealValuedNumericQ
RealValuedNumericQ[expr]
gives True if expr is a real-valued numeric quantity, and False otherwise.
Details
- RealValuedNumericQ[expr] gives True whenever N[expr] would yield an explicit number with head Real. »
- RealValuedNumericQ[Infinity] gives False. »
- RealValuedNumericQ[Overflow[]] and NumberQ[Underflow[]] give True. »
Examples
open all close allBasic Examples (2)
RealValuedNumericQ tests whether an object is a real-valued numeric quantity:
RealValuedNumericQ[Sin[Sqrt[2]]]RealValuedNumericQ[expr] gives True whenever N[expr] yields a number with head Real:
N[Sin[Sqrt[2]]]Head[%]A general symbolic expression is not a real-valued numeric quantity:
RealValuedNumericQ[Abs[x]]Scope (9)
Integers and rationals are real-valued numeric quantities:
RealValuedNumericQ[1]RealValuedNumericQ[(1/2)]Approximate reals are real-valued numeric quantities:
RealValuedNumericQ[5.6]RealValuedNumericQ[5.345`4]RealValuedNumericQ gives True for real-valued mathematical constants:
RealValuedNumericQ[π]RealValuedNumericQ[E]RealValuedNumericQ gives True for exact expressions representing real values:
RealValuedNumericQ[(1/1 + Sqrt[2])]RealValuedNumericQ[Sin[10]]Complex numbers are not real-valued quantities:
RealValuedNumericQ[I]Exact complex quantities whose imaginary part is zero are real valued:
myCos = Exp[I] - I Sin[1];
RealValuedNumericQ[myCos]The number has a real part of
and an imaginary part of
:
ReIm[myCos]Approximate complex numbers are not considered real valued even if their imaginary part equals zero:
z = 1.2 + 0. IRealValuedNumericQ[z]Im[z] == 0RealValuedNumericQ[Infinity] gives False:
RealValuedNumericQ[Infinity]RealValuedNumericQ[Overflow[]] and RealValuedNumericQ[Underflow[]] give True:
{o, u} = {$MaxNumber * 2, $MinNumber / 2}{RealValuedNumericQ[o], RealValuedNumericQ[u]}They are both treated as Real:
{Head[o], Head[u]}Properties & Relations (3)
If Head[N[x]] is Real, then RealValuedNumericQ[x] is True:
TableForm[Table[{x, RealValuedNumericQ[x], Head[N[x]]}, {x, {1, 3 / 2, 1.5, 1 + I, E, Sin[1], Underflow[], Overflow[], Infinity}}], TableHeadings -> {{}, {x, "RealValuedNumberQ", HoldForm@Head[N[x]]}}]It is possible for RealValuedNumericQ[x] to be True and for N[x] to have head Complex:
x = E ^ Pi + I(E + Pi) ^ 2 - I E ^ 2 - I Pi ^ 2 - I 2 E Pi;
{RealValuedNumericQ[x], Head[N[x]]}This indicates that x has an imaginary part that is exactly zero:
Im[x] == 0If RealValuedNumberQ[x] is True, then RealValuedNumericQ[x] is also True:
TableForm[Table[{x, RealValuedNumberQ[x], RealValuedNumericQ[x]}, {x, {1, 3 / 2, 1.5, 1 + I, E, Sin[1], Underflow[], Overflow[], Infinity}}], TableHeadings -> {{}, {x, "RealValuedNumberQ", "RealValuedNumericQ"}}]Possible Issues (2)
Exact quantities whose imaginary parts vanish may not be identified by RealValuedNumericQ:
x = Erf[Sqrt[2]] + I Erf[Log[4] + 2 Log[Sin[(π/8)]]] - I Erf[Log[2 - Sqrt[2]]];
RealValuedNumericQ[x]If detecting such numbers is important, simplify the expression before testing it:
RealValuedNumericQ[FullSimplify[x]]An exact number and its numerical approximation may give different results for RealValuedNumericQ:
myCos = Exp[I] - I Sin[1];
{RealValuedNumericQ[myCos], RealValuedNumericQ[N[myCos]]}It is not possible to determine if the number is real, as its imaginary part is only approximately zero:
N[myCos]Related Guides
History
Text
Wolfram Research (2023), RealValuedNumericQ, Wolfram Language function, https://reference.wolfram.com/language/ref/RealValuedNumericQ.html.
CMS
Wolfram Language. 2023. "RealValuedNumericQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RealValuedNumericQ.html.
APA
Wolfram Language. (2023). RealValuedNumericQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RealValuedNumericQ.html
BibTeX
@misc{reference.wolfram_2026_realvaluednumericq, author="Wolfram Research", title="{RealValuedNumericQ}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/RealValuedNumericQ.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_realvaluednumericq, organization={Wolfram Research}, title={RealValuedNumericQ}, year={2023}, url={https://reference.wolfram.com/language/ref/RealValuedNumericQ.html}, note=[Accessed: 13-June-2026]}