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 , , or .
The use of NaN representations is a relatively new development. Traditionally, the computation of indeterminate quantities such as or 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 and 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).