int fesetenv (const fenv_t* envp);
Set floating-point environment
Attempts to establish the state of the floating-point environment as represented by the object pointed by envp.
The floating point environment is a set of status flags and control modes affecting floating-point calculations (including both floating-point exceptions and the rounding direction mode).
If successful, the function changes the current state of the floating-point environment without actually raising the exceptions specified in such state.
Programs calling this function shall ensure that pragma FENV_ACCESS is enabled for the call.
- Either a pointer to a fenv_t value (filled by a previous call to fegetenv or feholdexcept), or one of the floating-point environment macro values:
Certain library implementations may support additional floating-point environment state values (with their corresponding macros also beginning with
|FE_DFL_ENV||Default floating-point environment (the same as at program startup).|
Zero, if the state was successfully established.
A non-zero value otherwise.
Each thread maintains a separate floating-point environment with its own state. Spawning a new thread copies the current state. [This applies to C11 and C++11 implementations]
No-throw guarantee: this function never throws exceptions.
- Update floating-point environment (function)
- Get floating-point environment (function)
- Set floating-point environment (function)