Exceptions for the Floating-Point Environment

Facilities for retrieving and setting the floating-point environment's status flags.

The floating-point environment has exception flags. When a floating-point operation gives an extraordinary result, the environment raises an exception. Raising a floatingpoint exception does not affect a program's execution. Instead, these exceptions act as status flags. The fenv.h header file offers facilities to clear, set, and test the state of these exceptions, allowing you to choose how your program manages and reacts to them.

The table below lists the macros that define the exceptions that affect these flags. To specify more than one exception, combine these macros with the bitwise-OR operator (|).
Table 1. Floating-point Exceptions
Macro Status Flag
FE_DIVBYZERO division by zero
FE_INEXACT inexact value
FE_INVALID invalid value
FE_OVERFLOW overflow
FE_UNDERFLOW underflow
FE_ALL_EXCEPT all exceptions combined