Namespaces
Variants
Actions

Standard library header <cfenv> (C++11)

From cppreference.com
< cpp‎ | header
 
 
Standard library headers
<cuchar> (C++11)
<string_view> (C++17)
<codecvt> (C++11/17/26*)
<regex> (C++11)
<text_encoding> (C++26)   
<cfenv> (C++11)
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<stdckdint.h> (C++26)
<chrono> (C++11)
<ccomplex> (C++11/17/20*)
<ciso646> (until C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

This header was originally in the C standard library as <fenv.h>.

This header is part of the floating-point environment library.

[edit] Types

fenv_t
(C++11)
the type representing the entire floating-point environment
(typedef) [edit]
fexcept_t
(C++11)
the type representing all floating-point status flags collectively
(typedef) [edit]

[edit] Functions

clears the specified floating-point status flags
(function) [edit]
determines which of the specified floating-point status flags are set
(function) [edit]
raises the specified floating-point exceptions
(function) [edit]
copies the state of the specified floating-point status flags from or to the floating-point environment
(function) [edit]
(C++11)(C++11)
gets or sets rounding direction
(function) [edit]
saves or restores the current floating-point environment
(function) [edit]
saves the environment, clears all status flags and ignores all future errors
(function) [edit]
(C++11)
restores the floating-point environment and raises the previously raised exceptions
(function) [edit]

[edit] Macros

floating-point exceptions
(macro constant) [edit]
floating-point rounding direction
(macro constant) [edit]
(C++11)
default floating-point environment
(macro constant) [edit]

[edit] Synopsis

#define FE_ALL_EXCEPT /* see description */
#define FE_DIVBYZERO /* see description */ // optional
#define FE_INEXACT /* see description */ // optional
#define FE_INVALID /* see description */ // optional
#define FE_OVERFLOW /* see description */ // optional
#define FE_UNDERFLOW /* see description */ // optional
 
#define FE_DOWNWARD /* see description */ // optional
#define FE_TONEAREST /* see description */ // optional
#define FE_TOWARDZERO /* see description */ // optional
#define FE_UPWARD /* see description */ // optional
 
#define FE_DFL_ENV /* see description */
 
namespace std {
 // types
 using fenv_t = /* object type */;
 using fexcept_t = /* object type */;
 
 // functions
 int feclearexcept(int except);
 int fegetexceptflag(fexcept_t* pflag, int except);
 int feraiseexcept(int except);
 int fesetexceptflag(const fexcept_t* pflag, int except);
 int fetestexcept(int except);
 int fegetround(void);
 int fesetround(int mode);
 int fegetenv(fenv_t* penv);
 int feholdexcept(fenv_t* penv);
 int fesetenv(const fenv_t* penv);
 int feupdateenv(const fenv_t* penv);
}

[edit] Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior
LWG 3905 C++11 std::fexcept_t must be an integer type it is an object type

AltStyle によって変換されたページ (->オリジナル) /