-ffast-math tells the compiler to perform more aggressive floating-point optimizations.
-ffast-math 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. Arm recommends that you use the alias option -ffp-mode=fast instead of -ffast-math.
Using -fno-fast-math disables aggressive floating-point optimizations. Arm recommends that you use the alias option -ffp-mode=full instead of -fno-fast-math.
Note:
Arm® Compiler6 uses
neither -ffast-math nor -fno-fast-math by default. For the default behavior, specify -ffp-mode=std.
These options control which floating-point library the compiler uses. For more information, see the library variants in Arm® C and C++ Libraries and Floating-Point Support User Guide.
Table
B1-2 Floating-point library variants
armclang
option
Floating-point library variant
Description
Default
fz
IEEE-compliant library with fixed rounding mode and support for certain IEEE exceptions, and flushing to zero.
-ffast-math
fz
IEEE-compliant library with fixed rounding mode and support for certain IEEE exceptions, and flushing to zero. However, because armclang performs aggressive floating-point optimizations that might cause a small loss of accuracy, the generated files are not IEEE-compliant.
-fno-fast-math
g
IEEE-compliant library with configurable rounding mode and support for all IEEE exceptions, and flushing to zero. This library is a software floating-point implementation, and can result in extra code size and lower performance.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.