FEHOLDEXCEPT 3CW "09 March 2006" "mathcw-1.00"
Table of contents
feholdexcept - save current floating-point environment
cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ]
#include <fenvcw.h>
extern int feholdexcept (fenv_t *envp);
Save the currently raised floating-point environment in the object
pointed to by
envp,
clear the floating-point status flags, and then install a nonstop
(continue on floating-point exceptions) mode, if available, for all
floating-point exceptions.
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 zero on success, and a negative value on failure.
None.
feclearexcept(3CW),
fegetenv(3CW),
fegetexceptflag(3CW),
fegetprec(3CW),
fegetround(3CW),
feraiseexcept(3CW),
fesetenv(3CW),
fesetexceptflag(3CW),
fesetprec(3CW),
fesetround(3CW),
fetestexcept(3CW),
feupdateenv(3CW).