The IEEE floating-point arithmetic is supported as follows:
The C/C++ compiler offers a compiler option with which floating-point numbers can be generated in IEEE format (see "Generating IEEE floating-point numbers by means of a compiler option").
For every library function in the C runtime system that works with or returns floatingpoint numbers, there is a variant for processing IEEE floating-point numbers and a macro define that maps the standard variant (/390 variant) of the function to the associated IEEE variant (see "C library functions that support IEEE floating-point numbers").
For each compiler option you can activate all the IEEE functionality: the C/C++ compiler then generates floating-point numbers in IEEE format in all modules and automatically provides the appropriate IEEE functions for processing the IEEE floating-point numbers.
In addition, you can use the IEEE functionality provided in a modified form:
You can use the
_IEEE_SOURCE
preprocessor define to specify whether the library functions for /390 floating-point arithmetic are mapped to the associated IEEE variants (see "Controlling the mapping of original functions to the associated IEEE variants").You can use conversion functions to convert floating-point numbers explicitly from /390 format to IEEE format (see "Explicit conversion of floating-point numbers").
Notes on the use of IEEE floating point arithmetic
The following points must be noted when using IEEE floating point arithmetic:
IEEE floating point operations differ semantically from the corresponding /390 floating point operations, e.g. in rounding. In IEEE format, "Round to nearest" is used by default whereas "Round to zero" is used in /390 format.
In error and exception cases (e.g. argument outside permitted value range) the reactions of IEEE functions differ from those of /390 functions, e.g. some functions return the value
NaN
.You must include the relevant include file for each C library function in your program that uses floating point numbers. Otherwise, these functions cannot process the floating point numbers correctly. You must, in particular, include the
<stdio.h>
include file with#include <stdio.h>
for the printf function.