Important: The information in this document is obsolete and should not be used for new development.
fesetenv
You can use thefesetenv
function to restore the floating-point environment.
void fesetenv (const fenv_t *envp);
envp
- A pointer to a word containing the value to which the environment should be set.
DESCRIPTION
Thefesetenv
function sets the floating-point environment to the value pointed to by its argumentenvp
. The value ofenvp
must come from a call to eitherfegetenv
orfeholdexcept
, or it may be the constantFE_DFL_ENV
, which specifies the default environment. In the default environment, all exception flags are clear and the rounding direction is set to the default.EXAMPLES
double_t func (double_t x, double_t y) { fenv_t *env; fesetenv(FE_DFL_ENV); /* clear environment */ x = x + y; /* floating-point op; may raise exceptions */ fegetenv(env); /* save state of env after add */ y = y * x; /* floating-point op; may raise exceptions */ fesetenv(env); /* ignore environmental changes by multiplication operator */ . . . }