FECLEAREXCEPT(3) DragonFly Library Functions Manual FECLEAREXCEPT(3)## NAME

feclearexcept,fegetexceptflag,feraiseexcept,fesetexceptflag,fetestexcept-- access floating-point status flags## SYNOPSIS

#include<fenv.h>intfeclearexcept(intexcepts);intfegetexceptflag(fexcept_t*flagp,intexcepts);intferaiseexcept(intexcepts);intfesetexceptflag(constfexcept_t*flagp,intexcepts);intfetestexcept(intexcepts);## DESCRIPTION

These functions provide access to the floating-point status flags. Theexceptsinput argument is a bitmask specifying an exception type and con- taining any of the values listed below. FE_DIVBYZERO A divide-by-zero exception occurs when the program attempts to divide a finite non-zero number by zero. FE_INEXACT An inexact exception is raised whenever there is a loss of precision due to rounding. FE_INVALID Invalid operation exceptions occur when a program attempts to perform calculations for which there is no reasonable representable answer. For instance, subtraction of infinities, division of zero by zero, ordered comparison involvingNaNs, and taking the square root of a negative number are all invalid opera- tions. FE_OVERFLOW An overflow exception occurs when the magnitude of the result of a computation is too large to fit in the destina- tion type. FE_UNDERFLOW Underflow occurs when the result of a computation is too close to zero to be represented as a non-zero value in the destination type. FE_DENORMAL Denormalization exception occurs when the result of a floating-point expression is a denormalized number. This is available only on the floating-point implementa- tions of amd64 and i386 processors. Additionally, the macro FE_ALL_EXCEPT is simply the bitwise OR of all floating-point exception macros listed above. Thefeclearexcept() function clears the floating-point exceptions repre- sented byexcepts. Thefegetexceptflag() function stores a representation of the states of the floating-point flags indicated byexceptsin the object pointed to byflagp. Theferaiseexcept() function raises floating-point exceptions represented byexcepts. Thefesetexceptflag() function sets the floating-point status flags indi- cated byexceptsto the states stored in the object pointed to byflagp. The value offlagpshall have been set by a previous call tofegetexceptflag() whose second argument represented at least those float- ing-point exceptions represented byexcepts. This function does not raise floating-point exceptions, but only sets the state of the flags. Thefetesteexcept() function determines which of a specified subset of the floating-point exception flags are currently set. Theexceptsspeci- fies the floating-point status flags to be queried.## RETURN VALUES

Thefeclearexcept(),fegetexceptflag(),feraiseexcept(), andfesetexceptflag() functions return zero on success, and non-zero if an error occurred. Thefetestexcept() function returns a bitmask of a spec- ified subset of the floating-point exception flags which are currently set.## SEE ALSO

feenableexcept(3), fegetenv(3), fegetround(3)## STANDARDS

Thefeclearexcept(),fegetexceptflag(),feraiseexcept(),fesetexceptflag(), andfetestexcept() functions conform to ISO/IEC 9899:1999 (``ISO C99''). The return types forfeclearexcept(),fegetexceptflag(),feraiseexcept(), andfesetexceptflag() areintfor alignment with ISO/IEC 9899:1999 (``ISO C99'') Defect Report #202.## HISTORY

These functions first appeared in OpenBSD 5.0.## CAVEATS

On some architectures,feraiseexcept() additionally raises the ``inexact'' floating-point exception whenever it raises the ``overflow'' or ``underflow'' floating-point exception. DragonFly 4.3 June 5, 2013 DragonFly 4.3