Set the floating point environment
#include <fpstatus.h> void fp_setenv( int rounding int flags int fmask int exc int emask);
Use the -l m option to qcc to link against this library.
Currently the fp_setenv() function is defined only for PPC (both SPE and non-SPE); it isn't defined for other architectures.
The fp_setenv() function is basically a combination of the functions fp_rounding() and fp_exception_mask() along with additional functionality. The fp_setenv() function permits:
|For all of the above situations, only the calling thread is affected.|
The parameters flags, fmask, exc, and emaskall represent sets of flags. The flags are exactly the same as those described for the new_mask parameter of fp_exception_mask():
After fp_setenv() is called (directly or indirectly), exceptions that aren't masked will result in SIGFPE being delivered to the thread whenever the corresponding exception occurs. Regardless of whether an exception was masked, the corresponding sticky exception flag is set whenever the associated exception occurs. Once raised, sticky exception flags remain raised until they're cleared by the application thread.
|This function doesn't return any value. There is no error indication.|
Clear all sticky flags and allow SIGFPE for divide-by-zero (only); the rounding mode remains unchanged:
fp_setenv(-1, 0, _FP_EXC_ALL, _FP_EXC_DIVZERO, _FP_EXC_DIVZERO);
fp_exception_mask(), fp_exception_value(), fp_precision() fp_rounding()