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

Table of contents


NAME

fesetexceptflag - set floating-point status flags

SYNOPSIS

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

#include <fenvcw.h>

extern int fesetexceptflag (const fexcept_t * flagp, int excepts);


DESCRIPTION

Set the floating-point status flags indicated by the argument excepts to the states stored in the object pointed to by flagp. The value of *flagp must have been set by a previous call to fegetexceptflag() whose second argument represented at least those floating-point exceptions represented by the argument excepts. This function does not raise floating-point exceptions, but only sets the state of the flags.

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), fegetexceptflag(3CW), fegetprec(3CW), fegetround(3CW), feholdexcept(3CW), feraiseexcept(3CW), fesetenv(3CW), fesetprec(3CW), fesetround(3CW), fetestexcept(3CW), feupdateenv(3CW).