FECLEAREXCEPT(3) Library Functions Manual FECLEAREXCEPT(3)

feclearexcept, fegetexceptflag, feraiseexcept, fesetexceptflag, fetestexceptfunctions providing access to the floating-point status flags.

#include <fenv.h>
#pragma STDC FENV_ACCESS ON

int
feclearexcept(int excepts);

int
feraiseexcept(int excepts);

int
fetestexcept(int excepts);

int
fegetexceptflag(fexcept_t *flagp, int excepts);

int
fesetexceptflag(fexcept_t *flagp, int excepts);

These functions provide access to the floating-point status flags. The int input argument excepts for the functions represents a subset of floating-point exceptions, and can be either zero or the bitwise OR of one or more floating-point exception macros defined in <fenv.h>, for example FE_OVERFLOW | FE_INEXACT. For other argument values the behavior of these functions is undefined.

The () function attempts to clear the supported floating-point flags corresponding to the exceptions specified by its argument. It returns zero if excepts is zero or if the flags corresponding to all specified exceptions were successfully cleared. Otherwise, it returns a nonzero value.

The () function attempts to raise the supported floating-point exceptions specified by its argument. Its effect is similar to that of arithmetic operations raising the same exceptions; if traps are enabled for the exceptions that are raised, they will be taken. The order in which these exceptions are raised is unspecified. On OS X and iOS, raising overflow or underflow using this function will additionally raise the inexact exception.

The () function returns zero if excepts is zero or if the specified exceptions were successfully raised. Otherwise a nonzero value is returned.

The () function determines if any of the floating-point flags corresponding to the exceptions specified by its argument are currently set. It returns the bitwise OR of the floating-point exception macros corresponding to the currently set flags indicated by excepts. For example, if the underflow and inexact flags are set in the floating-point environment, the result of fetestexcept(FE_INEXACT | FE_INVALID) will be FE_INEXACT.

The () function attempts to store an implementation-defined representation of the states of the floating-point status flags corresponding to the exceptions specified by excepts in the object pointed to by the argument flagp. It returns zero if the representation is successfully stored, and a nonzero value otherwise.

The () function attempts to set the floating-point status flags corresponding to the exceptions specified by excepts to the states stored in the object pointed to by flagp. This function does not raise floating-point exceptions--it only sets the state of the flags. The value of *flagp shall have been set by a previous call to fegetexceptflag() whose second argument represented a superset of the exceptions represented by excepts.

The () function returns zero if the excepts argument is zero or if all the specified flags were successfully set. Otherwise it returns a nonzero value.

fenv(3), fegetenv(3), fegetround(3), feholdexcept(3), fesetenv(3), fesetround(3), feupdateenv(3)

These functions conform to ISO/IEC 9899:TC3.

May 9, 2011 OS X