MachineNumberQ¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
MachineNumberQ[expr] gives True if expr is a machine-precision real or complex number, and False otherwise.
Examples (10)¶
Every input below was run against the current Mathilda build and its output recorded.
Basic examples (4)¶
In[1]:= StringQ["AbC"]
Out[1]= True
In[2]:= StringQ[""]
Out[2]= True
In[3]:= StringQ[123]
Out[3]= False
In[4]:= StringQ[] StringQ::argx: StringQ called with 0 arguments; 1 argument is expected.
Scope (6)¶
Overflows to +inf
MPFR, not machine
Exact Gaussian integer
Algorithm¶
Mathilda — numeric evaluation implementation.
See numeric.h for the module-level overview and extensibility notes.
This file implements N[expr] / N[expr, prec]. Phase 1 targets machine-precision IEEE doubles; Phase 2 (gated behind USE_MPFR) adds MPFR arbitrary precision. Phase-2 extension points are marked with an inline "Phase 2" marker so the eventual additions are obvious.
Implementation notes¶
builtin_machinenumberq (src/numeric.c) returns True when the argument is a finite EXPR_REAL (via is_machine_real_leaf, which checks EXPR_REAL and isfinite), or a Complex whose real and imaginary parts are both finite machine reals; otherwise False. Exact integers/rationals and arbitrary-precision EXPR_MPFR values are not machine numbers.
Attributes: Protected.
References¶
See also: AtomQ, NumberQ, IntegerQ, StringQ, Complex, ExactNumberQ
- Source:
src/numeric.c - Specification:
docs/spec/builtins/expression-information.md - Tests:
tests/test_hankelmatrix.c - Tests:
tests/test_hilbertmatrix.c - Tests:
tests/test_machine_number_q.c - Tests:
tests/test_toeplitzmatrix.c