Nota Number

Abbreviated NaN, Not-a-Number is used to signal a mathematical error where other error reporting mechanisms are not available. Any mathematical operation performed on NaN generally results in NaN. This propagates the error.

Another version, defined by the IeeeSevenFiftyFour standard, is known as the SignallingNan; mathematical operations performed on SignallingNan result in a processor exception being raised; rather than NaN being returned on a result (testing for NaN being an exception).

The comparison of two NaN values always returns false. The test for NaN-ness must be implemented as a library function.

The IEEE floating-point representation of NaN is an exponent of all 1s and a non-zero mantissa. Zero mantissa with all 1s in the exponent represents Infinity. Some language runtimes and/or VirtualMachines have been known to overload the numerous possible representations of NaN to stash away TagBits and other stuff - you could encode an entire 32-bit pointer plus change within a double-precision NaN.

Reference: ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic

NaN is an example of a NullObject and BottomPropagation.

EditText of this page (last edited August 15, 2004) or FindPage with title or text search