Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

fetestexcept(3m) [sunos man page]

fetestexcept(3M)					  Mathematical Library Functions					  fetestexcept(3M)

NAME
fetestexcept - test floating-point exception flags SYNOPSIS
cc [ flag... ] file... -lm [ library... ] #include <fenv.h> int fetestexcept(int excepts); DESCRIPTION
The fetestexcept() function determines which of a specified subset of the floating-point exception flags are currently set. The excepts argument specifies the floating-point status flags to be queried. RETURN VALUES
The fetestexcept() function returns the value of the bitwise-inclusive OR of the floating-point exception macros corresponding to the cur- rently set floating-point exceptions included in excepts. ERRORS
No errors are defined. EXAMPLES
Example 1: Example using fetestexcept() The following example calls function f( ) if an invalid exception is set, and then function g( ) if an overflow exception is set: #include <fenv.h> /* ... */ { # pragma STDC FENV_ACCESS ON int set_excepts; feclearexcept(FE_INVALID | FE_OVERFLOW); // maybe raise exceptions set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW); if (set_excepts & FE_INVALID) f(); if (set_excepts & FE_OVERFLOW) g(); /* ... */ } ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
feclearexcept(3M), fegetexceptflag(3M), fenv.h(3HEAD), attributes(5), standards(5) SunOS 5.10 1 Sep 2002 fetestexcept(3M)

Check Out this Related Man Page

FECLEAREXCEPT(3)					   BSD Library Functions Manual 					  FECLEAREXCEPT(3)

NAME
feclearexcept, fegetexceptflag, feraiseexcept, fesetexceptflag, fetestexcept -- functions providing access to the floating-point status flags. SYNOPSIS
#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); DESCRIPTION
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 feclearexcept() 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 feraiseexcept() 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 addition- ally raise the inexact exception. The feraiseexcept() function returns zero if excepts is zero or if the specified exceptions were successfully raised. Otherwise a nonzero value is returned. The fetestexcept() function determines if any of the floating-point flags corresponding to the exceptions specified by its argument are cur- rently 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 fegetexceptflag() 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 fesetexceptflag() 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 fesetexceptflag() function returns zero if the excepts argument is zero or if all the specified flags were successfully set. Otherwise it returns a nonzero value. SEE ALSO
fenv(3), fegetenv(3), fegetround(3), feholdexcept(3), fesetenv(3), fesetround(3), feupdateenv(3) STANDARDS
These functions conform to ISO/IEC 9899:TC3. OS X
May 9, 2011 OS X
Man Page