HP C A.06.05 Reference Manual
HP C/HP-UX Implementation Topics
IEEE Floating-Point Format
Chapter 10 241
NaNs are binary floating-point numbers that have all ones in the exponent and a nonzero
fraction. NaN is a term used for a binary floating-point number that has no value (that is,
“Not A Number”).
If E is within the range
E
min
<= E <= E
max
the mantissa field contains the number in a normalized form, preceded by an implicit 1 and
binary point.
In accordance with the IEEE standard, floating-point operations are performed with traps not
enabled, and the result of such an operation is that defined by the standard. This means, for
example, that dividing a positive finite number by zero will yield positive infinity, and no trap
will occur. Dividing zero by zero or infinity by infinity will yield a NaN, again with no trap. For
a discussion of infinity arithmetic and operations with NaNs, in the context of the IEEE
standard, see the HP Precision Architecture and Instruction Set Reference Manual (HP part
number 09740-90014).
For detailed information about floating-point arithmetic on HP-UX, how HP-UX implements
the IEEE standard, and the HP-UX math libraries, see the HP-UX Floating Point Guide.
Note that infinities and NaNs propagate through a sequence of operations. For example,
adding any finite number to infinity will yield infinity. An operation on a NaN will yield a
NaN. This means that you may be able to perform a sequence of calculations and then check
just the final result for infinity or NaN.
The HP-UX math library provides routines for determining the class of a floating point
number. For example, you can determine if a number is infinity or NAN. See the HP-UX
Reference for descriptions of the functions fpclassify, fpclassifyf, isinf, and isnan.