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 allclose allBasic Examples (2)
RealValuedNumericQ tests whether an object is a real-valued numeric quantity:
RealValuedNumericQ[expr] gives True whenever N[expr] yields a number with head Real:
A general symbolic expression is not a real-valued numeric quantity:
Scope (9)
Integers and rationals are real-valued numeric quantities:
Approximate reals are real-valued numeric quantities:
RealValuedNumericQ gives True for real-valued mathematical constants:
RealValuedNumericQ gives True for exact expressions representing real values:
Complex numbers are not real-valued quantities:
Exact complex quantities whose imaginary part is zero are real valued:
The number has a real part of and an imaginary part of :
Approximate complex numbers are not considered real valued even if their imaginary part equals zero:
RealValuedNumericQ[Infinity] gives False:
RealValuedNumericQ[Overflow[]] and RealValuedNumericQ[Underflow[]] give True:
They are both treated as Real:
Properties & Relations (3)
If Head[N[x]] is Real, then RealValuedNumericQ[x] is True:
It is possible for RealValuedNumericQ[x] to be True and for N[x] to have head Complex:
This indicates that x has an imaginary part that is exactly zero:
If RealValuedNumberQ[x] is True, then RealValuedNumericQ[x] is also True:
Possible Issues (2)
Exact quantities whose imaginary parts vanish may not be identified by RealValuedNumericQ:
If detecting such numbers is important, simplify the expression before testing it:
An exact number and its numerical approximation may give different results for RealValuedNumericQ:
It is not possible to determine if the number is real, as its imaginary part is only approximately zero:
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