-qfloat

Description

Specifies various floating-point options. These options provide different strategies for speeding up or improving the accuracy of floating-point calculations.

Syntax

Read syntax diagramSkip visual syntax diagram                .-:----------------.
                | .-nospnans-----. |
                | +-norsqrt------+ |
                | +-norrm--------+ |
                | +-norelax------+ |
                | +-nonans-------+ |
                | +-maf----------+ |
                | +-nohsflt------+ |
                | +-fold---------+ |
                | +-nofltint-----+ |
                V +-complexgcc---+ |
>>- -qfloat--=----+-nocomplexgcc-+-+---------------------------><
                  +-fltint-------+
                  +-nofold-------+
                  +-hsflt--------+
                  +-nomaf--------+
                  +-nans---------+
                  +-relax--------+
                  +-rrm----------+
                  +-rsqrt--------+
                  '-spnans-------'
 

Option selections are described in the Notes section below. See also #pragma options.

Notes

Using float suboptions other than the default settings may produce varying results in floating point computations. Incorrect computational results may be produced if not all required conditions for a given suboption are met. For these reasons, you should only use this option if you are experienced with floating-point calculations involving IEEE floating-point values and can properly assess the possibility of introducing errors in your program.

You can specify one or more of the following float suboptions.

complexgcc
nocomplexgcc
Enables compatibility with GCC passing parameters and returning values of complex type. The default is float=complexgcc when compiling in 32-bit mode, and float=nocomplexgcc when compiling in 64-bit mode.
fltint
nofltint
Speeds up floating-point-to-integer conversions by using faster inline code that does not check for overflows. The default is float=nofltint, which checks floating-point-to-integer conversions for out-of-range values.

This suboption must only be used with an optimization option.

  • With -O2 in effect, -qfloat=nofltint is the implied setting.
  • With -O3 and greater in effect, -qfloat=fltint is implied.

    To include range checking in floating-point-to-integer conversions with the -O3 option, specify -qfloat=nofltint.

  • -qnostrict sets -qfloat=fltint

Changing the optimization level will not change the setting of the fltint suboption if fltint has already been specified.

If the -qstrict | -qnostrict and -qfloat= options conflict, the last setting is used.

fold
nofold
Specifies that constant floating-point expressions are to be evaluated at compile time rather than at run time.
hsflt
nohsflt
Note:
The hsflt suboption is for specific applications in which floating-point computations have known characteristics. Using this option when you are compiling other application programs can produce incorrect results without warning. Also, using this option with -qfloat=rndsngl, -q64, or -qarch=ppc or any other PPC family architecture setting may produce incorrect results on rs64b or future systems.

The hsflt option speeds up calculations by truncating instead of rounding computed values to single precision before storing and on conversions from floating point to integer. The nohsflt suboption specifies that single-precision expressions are rounded after expression evaluation and that floating-point-to-integer conversions are to be checked for out-of-range values.

The hsflt suboption overrides the rndsngl, nans, and spnans suboptions.

The -qfloat=hsflt option replaces the obsolete -qhsflt option. Use -qfloat=hsflt in your new applications.

This option has little effect unless the -qarch option is set to pwr, pwr2, pwrx, pwr2s or, in 32-bit mode, com. For PPC family architectures, all single-precision (float) operations are rounded. This option only affects double-precision (double) expressions cast to single-precision (float).

maf
nomaf
Makes floating-point calculations faster and more accurate by using floating-point multiply-add instructions where appropriate. The results may not be exactly equivalent to those from similar calculations performed at compile time or on other types of computers. Negative zero results may be produced. This option may affect the precision of floating-point intermediate results.
nans
nonans
Generates extra instructions to detect signalling NaN (Not-a-Number) when converting from single-precision to double-precision at run time. The option nonans specifies that this conversion need not be detected. -qfloat=nans is required for full compliance to the IEEE 754 standard.

When used with the -qflttrap or -qflttrap=invalid option, the compiler detects invalid operation exceptions in comparison operations that occur when one of the operands is a signalling NaN.

relax
norelax
Relaxes the strict IEEE-conformance slightly for greater speed, typically by removing some trivial, floating-point arithmetic operations, such as adds and subtracts involving a zero on the right.
rrm
norrm
Prevents floating-point optimizations that are incompatible with runtime rounding to plus and minus infinity modes. Informs the compiler that the floating-point rounding mode may change at run time or that the floating-point rounding mode is not round to nearest at run time.

-qfloat=rrm must be specified if the Floating Point Status and Control register is changed at run time (as well as for initializing exception trapping).

rsqrt
norsqrt
Specifies whether a sequence of code that involves division by the result of a square root can be replaced by calculating the reciprocal of the square root and multiplying. Allowing this replacement produces code that runs faster.
  • For -O2, the default is -qfloat=norsqrt.
  • For -O3, the default is -qfloat=rsqrt. Use -qfloat=norsqrt to override this default.
  • -qnostrict sets -qfloat=rsqrt. (Note that -qfloat=rsqrt means that errno will not be set for any sqrt function calls.)
  • -qfloat=rsqrt has no effect unless -qignerrno is also specified.

Changing the optimization level will not change the setting of the rsqrt option if rsqrt has already been specified. If the -qstrict | -qnostrict and -qfloat= options conflict, the last setting is used.

spnans
nospnans
Generates extra instructions to detect signalling NaN on conversion from single-precision to double-precision. The option nospnans specifies that this conversion need not be detected.

Example

To compile myprogram.C so that constant floating point expressions are evaluated at compile time and multiply-add instructions are not generated, enter:

xlc++ myprogram.C -qfloat=fold:nomaf

Related information