Pragma equivalent
#pragma
options float
Purpose
Selects different strategies for speeding up
or improving the accuracy of floating-point calculations.
Syntax

.-:-------------------.
| .-nospnans--------. |
| +-norsqrt---------+ |
| +-norrm-----------+ |
| +-rngchk----------+ |
| +-norelax---------+ |
| +-nonans----------+ |
| +-maf-------------+ |
| +-nohsflt---------+ |
| +-nohscmplx-------+ |
| +-gcclongdouble---+ |
| +-fold------------+ |
| +-nofltint--------+ |
| +-nofenv----------+ |
V +-complexgcc------+ |
>>- -q--float--=----+-nocomplexgcc----+-+----------------------><
+-fenv------------+
+-fltint----------+
+-nofold----------+
+-nogcclongdouble-+
+-hscmplx---------+
+-hsflt-----------+
+-nomaf-----------+
+-nans------------+
+-relax-----------+
+-norngchk--------+
+-rrm-------------+
+-rsqrt-----------+
'-spnans----------'
Parameters
- complexgcc | nocomplexgcc
- Specifies whether GCC conventions for passing or returning complex
numbers are to be used. complexgcc preserves compatibility
with GCC-compiled code. This suboption does not have any effect if support
for complex types is not in effect; see -qlanglvl for details.
- fenv | nofenv
- Specifies whether the code depends on the hardware environment
and whether to suppress optimizations that could cause unexpected
results due to this dependency.
Certain floating-point operations
rely on the status of Floating-Point Status and Control Register (FPSCR),
for example, to control the rounding mode or to detect underflow.
In particular, many compiler built-in functions read values directly
from the FPSCR.
When nofenv is in effect, the compiler
assumes that the program does not depend on the hardware environment,
and that aggressive compiler optimizations that change the sequence
of floating-point operations are allowed. When fenv is in effect,
such optimizations are suppressed.
You should use fenv for
any code containing statements that read or set the hardware floating-point
environment, to guard against optimizations that could cause unexpected
behavior.
Any directives specified in the
source code (such as the standard C FENV_ACCESS pragma) take precedence
over the option setting.
- fltint | nofltint
- Speeds up floating-point-to-integer conversions by using an inline
sequence of code instead of a call to a library function. The library
function, which is called when nofltint is in effect, checks
for floating-point values outside the representable range of integers
and returns the minimum or maximum representable integer if passed
an out-of-range floating-point value.
If -qarch is
set to a processor that has an instruction to convert from floating
point to integer, that instruction will be used regardless of the [no]fltint setting.
This conversion also applies to all Power processors in 64-bit mode.
If
you compile with -O3 or higher optimization level, fltint is
enabled automatically. To disable it, also specify -qstrict, -qstrict=operationprecision, or -qstrict=exceptions.
- fold | nofold
- Evaluates constant floating-point expressions at compile time,
which may yield slightly different results from evaluating them at
run time. The compiler always evaluates constant expressions in specification
statements, even if you specify nofold.
- gcclongdouble | nogcclongdouble
- Specifies whether the compiler uses GCC-supplied or IBM-supplied
library functions for 128-bit long double operations.
gcclongdouble ensures
binary compatibility with GCC for mathematical calculations. If this
compatibility is not important in your application, you should use nogcclongdouble for
better performance. This suboption
only has an effect when 128-bit long double types are enabled with -qldbl128.
Note: Passing
results from modules compiled with
nogcclongdouble to modules
compiled with
gcclongdouble may produce different results for
numbers such as Inf, NaN and other rare cases. To avoid such incompatibilities,
the compiler provides built-in functions to convert IBM® long double types to GCC long double types;
see
Binary floating-point built-in functions for
more information.
- hscmplx | nohscmplx
- Speeds up operations involving complex division and complex absolute
value. This suboption, which provides a subset of the optimizations
of the hsflt suboption, is preferred for complex calculations.
- hsflt | nohsflt
- Speeds up calculations by preventing rounding for single-precision
expressions and by replacing floating-point division by multiplication
with the reciprocal of the divisor. It also uses the same technique
as the fltint suboption for floating-point-to-integer conversions. hsflt implies hscmplx.
The hsflt suboption
overrides the nans and spnans suboptions.
Note: Use -qfloat=hsflt on
applications that perform complex division and floating-point conversions
where floating-point calculations have known characteristics. In particular,
all floating-point results must be within the defined range of representation
of single precision. Use with discretion, as this option may produce
unexpected results without warning. For complex computations, it is
recommended that you use the hscmplx suboption (described above),
which provides equivalent speed-up without the undesirable results
of hsflt.
- 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 suboption may affect the precision
of floating-point intermediate results. If -qfloat=nomaf is
specified, no multiply-add instructions will be generated unless they
are required for correctness.
- nans | nonans
- Allows you to use the -qflttrap=invalid:enable option to
detect and deal with exception conditions that involve signaling
NaN (not-a-number) values. Use this suboption only if your program
explicitly creates signaling NaN values, because these values never
result from other floating-point operations.
- relax | norelax
- Relaxes 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. These
changes are allowed if either -qstrict=noieeefp or -qfloat=relax is
specified.
- rngchk | norngchk
- At optimization level -O3 and above, and without -qstrict,
controls whether range checking is performed for input arguments for
software divide and inlined square root operations. Specifying norngchk instructs
the compiler to skip range checking, allowing for increased performance
where division and square root operations are performed repeatedly
within a loop.
Note that with
norngchk in effect the following
restrictions apply:
- The dividend of a division operation must not be +/-INF.
- The divisor of a division operation must not be 0.0, +/- INF,
or denormalized values.
- The quotient of dividend and divisor must not be +/-INF.
- The input for a square root operation must not be INF.
If any of these conditions are not met, incorrect results may
be produced. For example, if the divisor for a division operation
is 0.0 or a denormalized number (absolute value < 2
-1022 for
double precision, and absolute value < 2
-126 for single
precision), NaN, instead of INF, may result; when the divisor is +/-
INF, NaN instead of 0.0 may result. If the input is +INF for a sqrt
operation, NaN, rather than INF, may result.
norngchk is
only allowed when -qnostrict is in effect. If -qstrict, -qstrict=infinities, -qstrict=operationprecision,
or -qstrict=exceptions is in effect, norngchk is
ignored.
- rrm | norrm
- Prevents floating-point optimizations that require the rounding
mode to be the default, round-to-nearest, at run time, by informing
the compiler that the floating-point rounding mode may change or is
not round-to-nearest at run time. You should use rrm if your
program changes the runtime rounding mode by any means; otherwise,
the program may compute incorrect results.
- rsqrt | norsqrt
- Speeds up some calculations by replacing division by the result
of a square root with multiplication by the reciprocal of the square
root.
rsqrt has no effect unless -qignerrno is
also specified; errno will not be set for
any sqrt function calls.
If you compile with -O3 or
higher optimization level, rsqrt is enabled automatically.
To disable it, also specify -qstrict, -qstrict=nans, -qstrict=infinities, -qstrict=zerosigns,
or -qstrict=exceptions.
- spnans | nospnans
- Generates extra instructions to detect signalling NaN on conversion
from single-precision to double-precision.
Note: - For details about the relationship between -qfloat suboptions
and their -qstrict counterparts, see -qstrict.
Usage
Using -qfloat suboptions other
than the default settings may produce incorrect results in floating-point
computations if not all required conditions for a given suboption
are met. For this reason, 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 also Handling
floating point operations for
more information.
If the -qstrict | -qnostrict and float suboptions
conflict, the last setting specified is used.
Predefined macros
Examples
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