HP-UX Floating-Point Guide
Chapter 2 45
Floating-Point Principles and the IEEE Standard for Binary Floating-Point Arithmetic
Floating-Point Formats
Not-a-Number (NaN)
A NaN (Not-a-Number) is a special IEEE representation for values
that are
• The result of an invalid operation
• The result returned by a library function when it would be incorrect
to return a numeric value
• An undetermined value
NaNs are represented by setting all of the bits in the exponent to 1 and
setting at least one of the bits in the fraction field to 1.
There are two types of NaNs—a signaling NaN (SNaN) and a quiet
NaN (QNaN). When an SNaN is used, it generates an invalid operation
exception and, if a trap for this exception is enabled, it produces a trap.
A QNaN does not generate an exception; instead, it silently propagates
through an operation. Floating-point operations produce only QNaNs.
NOTE The IEEE standard does not fully define the bit patterns used by the two
types of NaNs. HP 9000 systems use the most significant bit of the
fraction to differentiate between the two types. If the bit is set to 1, it is
an SNaN; if the bit is 0, it is a QNaN.
Table 2-4 shows some of the properties of NaNs.