float

Option Type Default Values #pragma options C C++
-qoption noemulate
nofltint
fold
nohsflt
nohssngl
maf
norndsngl
norrm
norsqrt
nospnans
FLOAT x x

Syntax:

    -qfloat=suboptions 
    FLOAT=suboptions 

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

Notes
Using the float option may produce results that are not precisely the same as the default. Incorrect results may be produced if not all required conditions 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. See Using Floating-Point Options on the RISC System/6000 System before using this option.

The float option has the following suboptions. If you use more than one suboption, separate each one with a colon (:).

-qfloat=emulate | -qfloat=noemulate Emulates the floating-point instructions omitted by the PowerPC 403 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:

-qfloat=fltint | -qfloat=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.

  • For -O2, the default is -qfloat=nofltint.
  • For -O3, the default is -qfloat=fltint.

    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 option if fltint has already been specified.

This option is ignored unless -qarch=pwr or, in 32-bit mode, -qarch=com. 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.

-qfloat=fold | -qfloat=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.

-qfloat=hsflt | -qfloat=nohsflt Speeds up calculations by truncating instead of rounding computed values to single precision before storing and on conversions from floating point to integer. nohsflt 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 option overrides the rndsngl, nans, and spnans options.

Note: The hsflt option 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.

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 and the option only affects double-precision (double) expressions cast to single-precision (float).

Using this option with -qfloat=rndsngl or -q64 or -qarch=ppc or any ppc family architecture may produce incorrect results on rs64b or future systems.

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

The -qfloat=hssngl option replaces the obsolete -qhssngl option. Use -qfloat=hssngl 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 and the 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.

Using this option with -qfloat=rndsngl or -q64 or -qarch=ppc or any ppc family architecture may produce incorrect results on rs64b or future systems.

-qfloat=maf | -qfloat=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. 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.

-qfloat=nans | -qfloat=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.

qfloat=rndsngl | -qfloat=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 option overrides the rndsngl option.

This option 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.

-qfloat=rrm | -qfloat=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.

-qfloat=rsqrt | -qfloat=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.

-qfloat=spnans | -qfloat=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 option overrides the spnans option.

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

Example
To compile myprogram.c so that range checking occurs and multiply-add instructions are not generated, enter:

xlC myprogram.c -qfloat=fltint:nomaf


RISC System/6000 Floating Point Hardware


List of Batch Compiler Options and Their Defaults
Options that Define the Compiler Object Code Produced
Equivalent Batch Compile-Link and Incremental Build Options