FEGETEXCEPTFLAG 3CW "17 April 2006" "mathcw-1.00"

Table of contents


NAME

fegetexceptflag - get floating-point status flags

SYNOPSIS

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

#include <fenvcw.h>

extern int fegetexceptflag (fexcept_t *flagp, int excepts);


DESCRIPTION

Get floating-point exception flags corresponding to the argument excepts, which 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. Store the requested flags in the flagp object, which is an opaque data type that should not be directly accessed by user code. This function is little more than an alternate interface to fetestexcept(3CW), storing the requested flags in a location determined by a pointer argument, instead of returning them as a function value.

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 zero on success, and a negative value on failure.

ERRORS

None.

SEE ALSO

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