ExactNumberQ, InexactNumberQ, NumberQ, NumericQ

ExactNumberQ is undocumented, but as far as I can tell it returns True if it's argument has the head Integer, Rational, or if the argument is complex with infinite precision.  It seems ExactNumberQ returns False in every other case as demonstrated with the next input.  You may not be familiar with the feature Root that I use below, but it's well documented in the Help Browser and The Mathematica Book.  I suggest you refer to this documentation if you are confused with the use of Root below.

Clear[x] ; ExactNumberQ/@{3, 5/3, 2 + 3} ExactNumberQ/@{π, 3.2, 2.3 + 1.25 ... , 50], N[π (1 + ), 50], 3^(1/2), π/4, Root[-7 - #1 + #1^3&, 1], ∞, x}

{True, True, True}

{False, False, False, False, False, False, False, False, False, False, False, False}

InexactNumberQ is also undocumented it seems InexactNumberQ returns True if it's argument is an approximate number (real or complex), and returns False in every other case.

InexactNumberQ/@{3.2, 2.3 + 1.25, 2.3 + 5, 2 + 1.25, N[π, 50], N[ ... rQ/@{3, 5/3, 2 + 3, ∞, 3^(1/2), π/4, Root[-7 - #1 + #1^3&, 1], ∞, x}

{True, True, True, True, True, True}

{False, False, False, False, False, False, False, False, False}

NumberQ is documented and it's usage message is given below

? NumberQ

NumberQ[expr] gives True if expr is a number, and False otherwise. More…

It seems NumberQ  returns True whenever it's argument has the head Integer, Rational, Real, or Complex and False in every other case.

NumberQ/@{3.2, 2.3 + 1.25, 3, 5/3, 2/3 + 3, 3^300, (3/5)^300, 3^300 + 5^200 &# ... #960; (1 + ), 50]} NumberQ/@{∞, 3^(1/2), π/4, Root[-7 - #1 + #1^3&, 1], x}

{True, True, True, True, True, True, True, True, True, True}

{False, False, False, False, False}

NumericQ is also documented and it's usage message is given below.  NumericQ  recognizes things like 3^(1/2) as numeric values as demonstrated below.  Infinity and Indeterminate are not considered numeric.

? NumericQ

NumericQ[expr] gives True if expr is a numeric quantity, and False otherwise. More…

NumericQ/@{3.2, 2.3 + 1.25, 3, 5/3, 2 + 3, 3^(1/2), π/4, Root[-7 - #1 + # ... amp;, 1], N[π, 50], N[π (1 + ), 50]} NumericQ/@{∞, 1/0, 0./0, ∞, x}

{True, True, True, True, True, True, True, True, True, True}

{False, False, False, False, False}


Created by Mathematica  (May 16, 2004)

Back to Ted’s Tricks index page