The ARM Compiler toolchain does not support floating-point exception trapping for AArch64 targets.

The ARM compiler toolchain supports an interface to the status word in the floating-point environment. This interface is provided as function __ieee_status() and it is generally the most efficient function to use for modifying the status word for VFP. __ieee_status() is defined in fenv.h.

The function prototype for __ieee_status() is:

unsigned int __ieee_status(unsigned int mask, unsigned int flags);


This function requires a floating-point model that supports exceptions. In ARM Compiler 6 this is enabled by default, and is disabled by armclang command-line options such as -ffast-math.

__ieee_status() modifies the writable parts of the status word according to the parameters, and returns the previous value of the whole word.

The writable bits are modified by setting them to:

new = (old & ~mask) ^ flags;

Four different operations can be performed on each bit of the status word, depending on the corresponding bits in mask and flags. See Table 4.

Table 4. Status word bit modification

Bit of maskBit of flagsEffect
00Leave alone
10Set to 0
11Set to 1

The layout of the status word as seen by __ieee_status() is shown in Figure 2.

Figure 2. IEEE status word layout

To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.

The fields in Figure 2 are as follows:

In addition to defining the __ieee_status() call itself, fenv.h also defines the following constants to be used for the arguments:

#define FE_IEEE_FLUSHZERO          (0x01000000)
#define FE_IEEE_ROUND_TONEAREST    (0x00000000)
#define FE_IEEE_ROUND_UPWARD       (0x00400000)
#define FE_IEEE_ROUND_DOWNWARD     (0x00800000)
#define FE_IEEE_ROUND_TOWARDZERO   (0x00C00000)
#define FE_IEEE_ROUND_MASK         (0x00C00000)
#define FE_IEEE_MASK_INVALID       (0x00000100)
#define FE_IEEE_MASK_DIVBYZERO     (0x00000200)
#define FE_IEEE_MASK_OVERFLOW      (0x00000400)
#define FE_IEEE_MASK_UNDERFLOW     (0x00000800)
#define FE_IEEE_MASK_INEXACT       (0x00001000)
#define FE_IEEE_MASK_ALL_EXCEPT    (0x00001F00)
#define FE_IEEE_INVALID            (0x00000001)
#define FE_IEEE_DIVBYZERO          (0x00000002)
#define FE_IEEE_OVERFLOW           (0x00000004)
#define FE_IEEE_UNDERFLOW          (0x00000008)
#define FE_IEEE_INEXACT            (0x00000010)
#define FE_IEEE_ALL_EXCEPT         (0x0000001F)

For example, to set the rounding mode to round down, you would call:


To trap the Invalid Operation exception and untrap all other exceptions:


To untrap the Inexact Result exception:

__ieee_status(FE_IEEE_MASK_INEXACT, 0);

To clear the Underflow sticky flag:

__ieee_status(FE_IEEE_UNDERFLOW, 0);

Show/hideSee also


ARM C and C++ Libraries and Floating-Point Support User Guide:


ARM C and C++ Libraries and Floating-Point Support User Guide:

Copyright © 2014 ARM. All rights reserved.ARM DUI 0809A