Next: fesetexceptflag, Previous: feraiseexcept, Up: Fenv [Contents][Index]

### 3.7 `fesetenv`—set current floating-point environment

Synopsis

    #include <fenv.h>
    int fesetenv(const fenv_t *envp);

    Link with -lm.

Description
This method attempts to establish the floating-point environment pointed to by envp. The argument envp must point to a floating-point environment obtained via `fegetenv` or `feholdexcept` or a floating-point environment macro such as `FE_DFL_ENV`.

It only sets the states of the flags as recorded in its argument, and does not actually raise the associated floating-point exceptions.

Returns
If floating-point environment was successfully established, then this method returns zero. Otherwise, a non-zero value is returned.

Portability
ANSI C requires `fesetenv`.

Not all Newlib targets have a working implementation. Refer to the file `sys/fenv.h` to see the status for your target.