You copied the Doc URL to your clipboard.

-ffp-mode

-ffp-mode specifies floating-point standard conformance. This controls which floating-point optimizations the compiler can perform, and also influences library selection.

Syntax

-ffp-mode=model

Where model is one of the following:

std

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=std causes undefined behavior.

fast

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 __ARM_FP_FAST.

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, float y = (float)(x + 1.0) is evaluated as float y = (float)x + 1.0f.

  • Division by a floating-point constant is replaced by multiplication with its reciprocal. For example, x / 3.0 is evaluated as x * (1.0 / 3.0).

  • It is not guaranteed that the value of errno is 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 sqrt() or sqrtf().

Using a NaN with -ffp-mode=fast can produce undefined behavior.

full

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 ARM C and C++ Libraries and Floating-Point Support User Guide.

Table 1-3 Floating-point library variant selection

armclang option Floating-point library variant Description
-ffp-mode=std fz IEEE-compliant library with fixed rounding mode and support for certain IEEE exceptions, and flushing to zero.
-ffp-mode=fast fz Similar to the default behavior, but also performs aggressive floating-point optimizations and therefore it is not IEEE-compliant.
-ffp-mode=full g IEEE-compliant library with configurable rounding mode and support for all IEEE exceptions, and flushing to zero.

Default

The default is -ffp-mode=std.

Was this page helpful? Yes No