Non-Confidential | PDF version | DUI0774J | ||

| ||||

Home > Compiler Command-line Options > -ffast-math, -fno-fast-math |

`-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. It also ensures that the floating-point code that the
compiler generates is compliant with the IEEE Standard for Floating-Point Arithmetic
(IEEE 754). Arm recommends that you use the alias option `-ffp-mode=full`

instead of `-fno-fast-math`

`-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
1-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` |
Similar to the default behavior, but also performs aggressive floating-point optimizations and therefore it is not IEEE-compliant. |

`-fno-fast-math` |
`g` |
IEEE-compliant library with configurable rounding mode and support for all IEEE exceptions, and flushing to zero. |