FETESTEXCEPT 3CW "09 March 2006" "mathcw-1.00"

Table of contents


NAME

fetestexcept - test floating-point exception flags

SYNOPSIS

cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ]

#include <fenvcw.h>

extern int fetestexcept (int excepts);


DESCRIPTION

Determine which of a specified subset of floating-point exception flags are currently set. The argument excepts is the bitwise OR of one or more of the symbolic names FE_DIVBYZERO, FE_INEXACT, FE_INVALID, FE_OVERFLOW, and FE_UNDERFLOW, or the symbolic name FE_ALL_EXCEPT, which is the bitwise OR of all five of them.

NOTES

The 1999 ISO C Standard allows two ways of dealing with floating-point exceptions: (1) recording the exceptions in sticky flags that are cleared only at user request, and (2) software exception handlers that are invoked when a floating-point exception occurs. The exception handler might then be able to log the location of the exception, and possibly provide a result for the failing instruction. However, the registering of exception handlers is not defined by the Standard, and thus is unlikely to be portable. On most modern high-performance computer systems, multiple instructions are in simultaneous execution, and it is impractical, or impossible, for an exception handler to determine the location of the failing instruction, or to provide a result for it. In practice, all that such a handler could do would be to log the exception, and then terminate the job. The mathcw library implementation of the floating-point environment functions supports only the setting and testing of the sticky exception flags, and raising an exception then means only that a sticky flag is set; no exception handler is invoked, nor is there any provision for registering such a handler.

RETURN VALUES

Return the bitwise OR of the selected flags on success, and a negative value on failure.

ERRORS

None.

SEE ALSO

feclearexcept(3CW), fegetenv(3CW), fegetexceptflag(3CW), fegetprec(3CW), fegetround(3CW), feholdexcept(3CW), feraiseexcept(3CW), fesetenv(3CW), fesetexceptflag(3CW), fesetprec(3CW), fesetround(3CW), feupdateenv(3CW).