Floating-point environment

From Cppreference

Jump to: navigation, search

The floating-point environment is the set of floating-point status flags and control modes supported by the implementation. It is thread-local, each thread inherits the initial state of its floating-point environment from the parent thread. Floating-point operations modify the floating-point status flags to indicate abnormal results or auxiliary information. The state of floating-point control modes affects the outcomes of some floating-point operations.

Types

Defined in header <cfenv>
fenv_t The type representing the entire floating-point environment
fexcept_t The type representing all floating-point status flags collectively

Functions

feclearexcept
clears the specified floating-point status flags
(function)
fegetexceptflag
saves the state of the specified floating-point status flags
(function)
feraiseexcept
raises the specified floating-point exceptions
(function)
fesetexceptflag
restores the state of the specified floating-point status flags
(function)
fetestexcept
determines which of the specified floating-point status flags are set
(function)
fegetround
gets the current rounding direction
(function)
fesetround
establishes the new rounding direction
(function)
fegetenv
saves the current floating point environment
(function)
feholdexcept
saves the environment, clears all status flags and ignores all future errors
(function)
fesetenv
restores the floating-point environment without raising exceptions
(function)
feupdateenv
restores the floating-point environment and raises the previously raise exceptions
(function)

Macros

FE_ALL_EXCEPT
bitwise OR of all floating-point exception macros
(macro constant)
FE_DIVBYZERO
floating-point exception division by zero
(macro constant)
FE_INEXACT
floating-point exception inexact result
(macro constant)
FE_INVALID
floating-point exception invalid operation
(macro constant)
FE_OVERFLOW
floating-point exception overflow
(macro constant)
FE_UNDERFLOW
floating-point exception underflow
(macro constant)
FE_DOWNWARD
rounding direction
(macro constant)
FE_TONEAREST
rounding direction
(macro constant)
FE_TOWARDZERO
rounding direction
(macro constant)
FE_UPWARD
rounding direction
(macro constant)
FE_DFL_ENV
default floating-point environment
(macro constant)