fp_setenv()

Synopsis:

Arguments:

Modify the thread's exception mask. This parameter is analogous with flags.

emask

Modify the thread's exception mask. This parameter is analogous with fmask. This is the same mask that's manipulated by the fp_exception_mask() function.

flags

Describe the sticky exception flags that are set or cleared. For each flag that's set in fmask, the corresponding sticky exception flag of the thread is set if that flag is also set in flags; otherwise, it's cleared. Sticky exception flags for which the corresponding flag isn't set in fmask are unchanged.

fmask

Describes the sticky exception flags that are set or cleared. For each flag that's set in fmask, the corresponding sticky exception flag of the thread is set if that flag is also set in flags; otherwise, it's cleared. Sticky exception flags for which the corresponding flag isn't set in fmask are unchanged.

rounding

The rounding mode. You can use -1 for unchanged. The rounding parameter is treated exactly as for the fp_rounding() function.

Library:

Description:

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:

the calling thread to set its floating point rounding mode

a change its set of currently set sticky exception flags

a change its set of enabled exceptions.

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():

_FP_EXC_INVALID

_FP_EXC_DIVZERO

_FP_EXC_OVERFLOW

_FP_EXC_UNDERFLOW

_FP_EXC_INEXACT

_FP_EXC_DENORMAL

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.