C/C++ Programmer's Guide (G06.25+)

Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems429301-008
13-47
IEEE_FLOAT
In addition to the differences shown in Table 13-4, note the following:
°
For the float type in IEEE floating-point format, the smallest positive nonzero
number is approximately 1.40129846E-45. This is a denormalized number;
Tandem floating-point format does not have denormalized numbers.
°
For the double type in IEEE floating-point format, the smallest positive
nonzero number is approximately 4.9406564584124654E-324. This is a
denormalized number.
°
IEEE floating-point format has special values for Infinity and Not a Number
(NaN). In addition, for every value except NaN values, there is a positive value
and a negative value. This includes infinities (+Infinity and -Infinity) and zeroes
(+0 and -0).
When converting from fixed-point to floating-point format or from a floating-point
number to a narrower floating-point number, IEEE floating point typically rounds to
the nearest value according to the current IEEE floating-point rounding mode.
When converting from floating-point to fixed-point formats, IEEE floating-point
normally truncates the nearest representable value, as specified by the ANSI C
standard.
The IEEE floating-point standard requires a way to convert from floating point to
fixed point with rounding. To make this conversion, use the rint() function and
then cast the result to an integer type.
A new header file (ieeefp.h) has been introduced which contains interfaces that
apply only to IEEE floating point and are callable only when compiling using the
IEEE_FLOAT pragma. Calling the functions in ieeefp.h when generating TNS
floating-point code causes a syntax error because of incompatible floating-point
calling conventions. If you want to use any of the resources defined by ieeefp.h,
you must include it in your source.
For more information about compiling and linking programs that use IEEE floating-
point format, see Compiling and Linking Floating-Point Programs on page 16-4.