-ffp-mode specifies floating-point standard conformance. This controls which floating-point optimizations the compiler can perform, and also influences library selection.
is one of the following:
IEEE finite values with denormals flushed to zero, round-to-nearest, and no exceptions. This is compatible with standard C and C++ and is the default option.
Normal finite values are as predicted by the IEEE standard. However:
NaNs and infinities might not be produced in all circumstances defined by the IEEE model. When they are produced, they might not have the same sign.
The sign of zero might not be that predicted by the IEEE model.
Using NaNs in arithmetic operations with
-ffp-mode=stdcauses undefined behavior.
Perform more aggressive floating-point optimizations that might cause a small loss of accuracy to provide a significant performance increase. This option defines the symbol
This option results in behavior that is not fully compliant with the ISO C or C++ standard. However, numerically robust floating-point programs are expected to behave correctly.
A number of transformations might be performed, including:
Double-precision floating-point expressions that are narrowed to single-precision are evaluated in single-precision when it is beneficial to do so. For example,
is evaluated as
floaty = (
float)(x + 1.0)
floaty = (
float)x + 1.0f
Division by a floating-point constant is replaced by multiplication with its reciprocal. For example,
x / 3.0is evaluated as
x * (1.0 / 3.0).
It is not guaranteed that the value of
errnois compliant with the ISO C or C++ standard after math functions have been called. This enables the compiler to inline the VFP square root instructions in place of calls to
Using a NaN with
-ffp-mode=fastcan produce undefined behavior.
All facilities, operations, and representations guaranteed by the IEEE Standard for Floating-Point Arithmetic (IEEE 754) are available in single and double-precision. Modes of operation can be selected dynamically at runtime.
These options control which floating-point library the compiler uses. For more information, see the library variants in the Arm® C and C++ Libraries and Floating-Point Support User Guide.
When using the
fast modes, the binary
representation of a floating-point number that cannot be represented exactly by its
type can differ depending on whether it is evaluated by the compiler at compile time
or generated at run time using one of the following string to floating-point
- A member of the
scanf()family of functions using a floating-point conversion specifier.
Table 1-3 Floating-point library variant selection
||Floating-point library variant||Description|
||IEEE-compliant library with fixed rounding mode and support for certain IEEE exceptions, and flushing to zero.|
||Similar to the default behavior, but also performs aggressive floating-point optimizations and therefore it is not IEEE-compliant.|
||IEEE-compliant library with configurable rounding mode and support for all IEEE exceptions, and flushing to zero.|
The default is