TOPICS
Search

NaN


In the IEEE 754-2008 standard (referred to as IEEE 754 henceforth), NaN (or "not a number") is a symbolic floating-point representation which is neither a signed infinity nor a finite number. In general, NaNs occur as the output of computations which are somehow "indeterminate," e.g., when attempting to compute quantities such as +infty+(-infty), 0×infty, or 0/0.

The use of NaN representations is a relatively new development. Traditionally, the computation of indeterminate quantities such as 0/0 or sqrt(-1) was treated as an unrecoverable error which caused a computation to halt. In practice, however, it sometimes makes sense for a computation to continue despite encountering such a scenario; in these situations, unnecessary halting can be avoided by specifying that the computation of expressions like 0/0 and sqrt(-1) output NaN rather than halting the program (Goldberg 1991).

Ostensibly, a NaN output should carry with it some degree of diagnostic information regarding the circumstances and/or operations which created it. The diagnostic information contained in a NaN is called its payload.

In IEEE 754, there are two distinct kinds of NaN representations, namely quiet NaN (or qNaN) and signaling NaN (or sNaN). Most operations within IEEE 754 propagate qNaNs without signaling exceptions while signaling an invalid operation exception when given an sNaN as input (IEEE Computer Society 2008).


See also

Arithmetic, Biased Exponent, Floating-Point Algebra, Floating-Point Arithmetic, Floating-Point Exponent, Floating-Point Normal Number, Floating-Point Number, Floating-Point Preferred Exponent, Floating-Point Quantum, Floating-Point Representation, IEEE 754-2008, Interval Arithmetic, NaN Payload, Quiet NaN, Signaling NaN, Significand, Subnormal Number

This entry contributed by Christopher Stover

Explore with Wolfram|Alpha

References

Goldberg, D. "What Every Computer Scientist Should Know About Floating-Point Arithmetic." ACM Comput. Surv. 23, 5-48, March 1991. http://docs.sun.com/source/806-3568/ncg_goldberg.html.IEEE Computer Society. "IEEE Standard for Floating-Point Arithmetic: IEEE Std 754-2008 (Revision of IEEE Std 754-1985)." 2008. http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=4610935.

Cite this as:

Stover, Christopher. "NaN." From MathWorld--A Wolfram Web Resource, created by Eric W. Weisstein. https://mathworld.wolfram.com/NaN.html

Subject classifications