Compiling for strict IEEE conformance
By default, XL C/C++ follows most but not all of the rules in the IEEE standard. If you
compile with the -qnostrict option, which is enabled
by default at optimization level -O3 or higher, some IEEE floating-point rules
are violated in ways that can improve performance but might affect
program correctness. To avoid this issue and to compile for strict
compliance with the IEEE standard, use the following
options:
- Use the -qfloat=nomaf compiler option.
- If the program changes the rounding mode at run time, use the -qfloat=rrm option.
- If the data or program code contains
signaling NaN values (NaNS), use any of the following groups of options.
(A signaling NaN is different from a quiet NaN; you must explicitly
code it into the program or data, or create it by using the -qinitauto compiler option.)
- The -qfloat=nans and -qstrict=nans options
- The -qfloat=nans and -qstrict options
- If you compile with -O3, -O4, or -O5, include the option -qstrict after it. You can also use the suboptions of -qstrict to refine the level of control for the transformations performed by the optimizers.