-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-----+ |
                | +-norndsngl-+ |
                | +-norelax---+ |
                | +-nonans----+ |
                | +-maf-------+ |
                | +-nohssngl--+ |
                | +-nohsflt---+ |
                | +-fold------+ |
                | +-nofltint--+ |
                V +-noemulate-+ |
>>- -qfloat--=----+-emulate---+-+------------------------------><
                  +-fltint----+
                  +-nofold----+
                  +-hsflt-----+
                  +-hssngl----+
                  +-nomaf-----+
                  +-nans------+
                  +-relax-----+
                  +-rndsngl---+
                  +-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.

emulate
noemulate
Emulates the floating-point instructions omitted by the PowerPC 403(TM) processor. The default is float=noemulate.

To emulate PowerPC 403 processor floating-point instructions, use -qfloat=emulate. Function calls are emitted in place of PowerPC 403 floating-point instructions. Use this option only in a single-threaded, stand-alone environment targeting the PowerPC 403 processor.

Do not use -qfloat=emulate with any of the following:

  • -qarch=pwr, -qarch=pwr2, -qarch=pwrx
  • -qlongdouble, -qldbl128
  • xlC128 or xlc128 compiler invocation commands
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.

For PWR2 and PPC family architectures, faster inline code is used that correctly handles out-of-range values.

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.

The -qfloat=fold option replaces the obsolete -qfold option. Use -qfloat=fold in your new applications.

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).

hssngl
nohssngl
Note:
Using this suboption with -qfloat=rndsngl, -q64, or -qarch=ppc or any other PPC family architecture setting may produce incorrect results on rs64b or future systems.

The hssngl option specifies that single-precision expressions are rounded only when the results are stored into float memory locations. The nohssngl option specifies that single-precision expressions are rounded after expression evaluation. Using hssngl can improve runtime performance and is safer than using -qfloat=hsflt.

This suboption 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) and used in an assignment operator for which a store instruction is generated.

The -qfloat=hssngl option replaces the obsolete -qhssngl option. Use -qfloat=hssngl in your new applications.

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.

The -qfloat=maf option replaces the obsolete -qmaf option. Use -qfloat=maf in your new applications.

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.

The hsflt option overrides the nans option.

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.

The -qfloat=nans option replaces the obsolete -qfloat=spnans option and the -qspnans option. Use -qfloat=nans in your new applications.

rndsngl
norndsngl
Specifies that the result of each single-precision (float) operation is to be rounded to single precision. -qfloat=norndsngl specifies that rounding to single-precision happens only after full expressions have been evaluated. Using this option may sacrifice speed for consistency with results from similar calculations on other types of computers.

The hsflt suboption overrides the rndsngl option.

This suboption has no 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.

Using this option with -qfloat=hssngl or -qfloat=hsflt may produce incorrect results on rs64b or future systems.

The -qfloat=rndsngl option replaces the obsolete -qrndsngl option. Use -qfloat=rndsngl in your new applications.

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).

The -qfloat=rrm option replaces the obsolete -qrrm option. Use -qfloat=rrm in your new applications.

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 when -qarch=pwr2 is also specified.
  • -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.

The hsflt suboption overrides the spnans suboption.

The -qfloat=spnans option replaces the obsolete -qfloat=spnans and -qspnans options. Use -qfloat=spnans in your new applications.

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