Systematic use of NaNs was introduced by the IEEE 754 floating-point standard in 1985, along with the representation of other non-finite quantities such as infinities.
In mathematics, the result of 0/0 is typically not defined as a number[a] and may therefore be represented by NaN in computing systems.
Signaling NaNs can support advanced features such as mixing numerical and symbolic computation or other extensions to basic floating-point arithmetic.
In general, then, a later test for a set invalid flag is needed to detect all cases where NaNs are introduced[3] (see Function definition below for further details).
As specified, the predicates associated with the <, ≤, =, ≥, > mathematical symbols (or equivalent notation in programming languages) return false on an unordered relation.
The other standard comparison predicates associated with the above mathematical symbols are all signaling if they receive a NaN operand.
There have been several ideas for how these might be used: When encountered, a trap handler could decode the sNaN and return an index to the computed result.
[citation needed] IEEE 754-2019 recommends the operations getPayload, setPayload, and setPayloadSignaling be implemented,[10] standardizing the access to payloads to streamline application use.
[11] According to the IEEE 754-2019 background document, this recommendation should be interpreted as "required for new implementations, with reservation for backward compatibility".
In practice, the most significant bit of the trailing significand field determined whether a NaN is signaling or quiet.
For IEEE 754-2008 conformance, the meaning of the signaling/quiet bit in recent MIPS processors is now configurable via the NAN2008 field of the FCSR register.
The value is usually chosen to be a quiet NaN with an all-zero payload and an arbitrarily-defined sign bit.
There are differences of opinion about the proper definition for the result of a numeric function that receives a quiet NaN as input.
Another view, and the one taken by the ISO C99 and IEEE 754-2008 standards in general, is that if the function has multiple arguments and the output is uniquely determined by all the non-NaN inputs (including infinity), then that value should be the result.
The expressions 00, ∞0 and 1∞ are considered indeterminate forms when they occur as limits (just like ∞ × 0), and the question of whether zero to the zero power should be defined as 1 has divided opinion.
Moreover, ISO C99, and later IEEE 754-2008, chose to specify pow(−1, ±∞) = 1 instead of qNaN; the reason of this choice is given in the C rationale:[24] "Generally, C99 eschews a NaN result where a numerical value is useful.
To satisfy those wishing a more strict interpretation of how the power function should act, the 2008 standard defines two additional power functions: pown(x, n), where the exponent must be an integer, and powr(x, y), which returns a NaN whenever a parameter is a NaN or the exponentiation would give an indeterminate form.
In such a case, when converting NaN to an integer type, the IEEE 754 standard requires that the invalid-operation exception be signaled.
[25] In C, they lead to undefined behavior, but if annex F is supported, the operation yields an "invalid" floating-point exception (as required by the IEEE standard) and an unspecified value.