function
<cfenv>

fegetenv

int fegetenv (fenv_t* envp);
Get floating-point environment
Attempts to store the current state of the floating-point environment in 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).

Programs calling this function shall ensure that pragma FENV_ACCESS is enabled for the call.

Parameters

envp
Pointer to a fenv_t object where the state of the floating-point environment is stored.

Return Value

Zero, if the state was successfully stored.
A non-zero value otherwise.

Data races

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]

Exceptions

No-throw guarantee: this function never throws exceptions.

See also