Stores the floating-point environment's exception status flags #include <fenv.h> int fegetexceptflag ( fexcept_t *flagp , int excepts ); The fegetexceptflag( ) function saves the current state of specified status flags in the floating-point environment, which indicate specific floating-point processing exceptions, in the object referenced by the pointer argument. The object type that represents the floating-point status flags, fexcept_t, is defined in fenv.h. Unlike the integer argument that represents the floating-point exception status flags in this and other functions that manipulate the floating-point environment, the object with type fexcept_t cannot be directly modified by user programs. The integer argument is a bitwise OR of the values of macros defined in fenv.h to represent the floating-point exception flags. The macros are listed under feraiseexcept( ) in this chapter. fegetexceptflag( ) stores the state of those flags which correspond to the values that are set in this mask. The function returns 0 if successful; a nonzero return value indicates that an error occurred. Example/* Temporarily store the state of the FE_INEXACT, FE_UNDERFLOW * and FE_OVERFLOW flags */ fexcept_t fpexcepts; #pragma STDC FENV_ACCESS ON /* Save state: */ fegetexceptflag( &fpexcepts, FE_INEXACT | FE_UNDERFLOW | FE_OVERFLOW ); feclearexcept( FE_INEXACT | FE_UNDERFLOW | FE_OVERFLOW ); /* ... Perform some calculations that might raise those exceptions ... */ /* ... Handle (or ignore) the exceptions our calculations raised ... */ /* Restore state as saved: */ fesetexceptflag( &fpexcepts, FE_INEXACT | FE_UNDERFLOW | FE_OVERFLOW ); See Alsofesetexceptflag( ), feraisexcept( ), feclearexcept( ), fetestexcept( ) |