Infinity and NaNs
The IEEE standard specifies a variety of special exponent and mantissa values in order to support the concepts of plus and minus infinity and “Not-a-Number” (NaN).
Arithmetic involving infinity is treated as the limiting case of real arithmetic, with infinite values defined as those outside the range of representable numbers, or
−∞ < representable numbers < +∞
With the exception of the special cases discussed below (NaNs), any arithmetic operation involving infinity yields infinity. Infinity is represented by the largest biased exponent allowed by the format and a mantissa of zero.
A NaN (Not-a-Number) is a symbolic entity encoded in floating-point format. There are two types of NaNs:
signals an invalid operation exception
propagates through almost every arithmetic operation without signalling an exception
NaNs are produced by these operations:
∞ − ∞, −∞ + ∞, 0 × ∞, 0 ÷ 0, ∞ ÷ ∞
Both types of NaNs are represented by the largest biased exponent allowed by the format (single- or double-precision) and a mantissa that is non-zero.
For single-precision values:
For double-precision values:
last updated: 27-Nov-03 Ian Harries <firstname.lastname@example.org>