fesetenv() — Set the floating-point environment

Standards

Standards / Extensions C or C++ Dependencies
C99
Single UNIX Specification, Version 3
C/C++ DFP
C++ TR1 C99
both  z/OS® V1R8pd

Format

#define _ISOC99_SOURCE
#include <fenv.h>

int fesetenv(const fenv_t *envp);

General description

fesetenv() establishes the floating-point environment represented by the object pointed to by envp. The argument envp points to an object set by a call to fegetenv() or feholdexcept(), or equal to a floating-point environment macro. fesetenv() merely installs the state of the floating-point status flags represented through envp and does not raise these floating-point exceptions.
Note: The following table shows the viable formats for these functions. See IEEE binary floating-point for more information about IEEE Binary Floating-Point.
Function Hex IEEE
fesetenv   X
Notes:
  1. If the hardware has the Decimal Floating-Point Facility installed, this function can be used to set the decimal floating-point rounding mode.
  2. This function works in IEEE decimal floating-point format. See "IEEE Decimal Floating-Point" for more information.

Returned value

If successful, fesetenv() returns 0 if the settings are restored.

If unsuccessful, fesetenv() returns -1 and sets one of the following errno values:

Error Code
Description
EINVAL
The rounding mode specified is not a valid Decimal Floating Point rounding mode.
EMVSERR
The function was unable to set the specified rounding mode due to an internal error.

Related information