Important: The information in this document is obsolete and should not be used for new development.
Controlling the Exception Flags
In MathLib, the following functions control the floating-point exception flags:
feclearexcept Clears one or more exceptions. fegetexcept Saves one or more exception flags. feraiseexcept Raises one or more exceptions. fesetexcept Restores the state of one or more exception flags. fetestexcept Returns the value of one or more exception flags. The five floating-point exception flags are defined as the constants shown in Table 8-2.
Table 8-2 Floating-point exception flags in MathLib Exception Constant Inexact FE_INEXACT Divide-by-zero FE_DIVBYZERO Underflow FE_UNDERFLOW Overflow FE_OVERFLOW Invalid FE_INVALID MathLib also defines another constant,
FE_ALL_EXCEPT
, which is the logical OR of all five exceptions. UsingFE_ALL_EXCEPT
, you can manipulate all five floating-point exception flags as a single entity. The typefexcept_t
also exists so that all
the exception flags may be accessed at once.