# 5.4  Infinities and NaNs

The upper extreme value of the exponent field is reserved for encoding non-numerical entities. According to Definition 5.2.2, an encoding for an explicit formal with exponent field is unsupported if its integer bit is 0. In all other cases an encoding with this exponent field is an infinity is its significand field is 0, and a NaN (Not a Number) otherwise. A NaN is further classified as an SNaN (signaling NaN) or a QNaN according the the MSB of its mantissa field:

Definition 5.4.1   (infp, nanp, snanp, qnanp) Let be an encoding for a format with and assume that if is explicit, then .

(a) is an infinity for iff ;

(b) is a NaN for iff ;

(c) is an SNaN for iff is a NaN and ;

(c) is a QNaN for iff is a NaN and .

This function constructs an infinity with a given sign:

Definition 5.4.2   (iencode) Let be a format and let . Then

The following function converts an SNaN to a QNaN:

Definition 5.4.3   (qnanize) If is a NaN encoding for a format , then

The following encoding, known as the real indefinite QNaN, has special significance in the handling of floating-point exceptions:

Definition 5.4.4   (indef) For any encoding ,

Infinities and NaNs will be discussed further in Part III.

David Russinoff 2016-10-04