命名空间
变体
操作

标准库头文件 <cfenv> (C++11)

来自 cppreference.cn
< cpp‎ | header
 
 
标准库头文件
算法
<algorithm>
<numeric>
字符串
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
文本处理
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
数值
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<valarray>
时间
<chrono> (C++11)
<ctime>
C 兼容性
<ccomplex> (C++11/17/20*)
<ciso646> (直到 C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

此头文件最初在 C 标准库中为 <fenv.h>

此头文件是浮点环境库的一部分。

目录

[编辑] 类型

fenv_t
(C++11)
表示整个浮点环境的类型
(typedef) [编辑]
fexcept_t
(C++11)
表示所有浮点状态标志的集合的类型
(typedef) [编辑]

[编辑] 函数

清除指定的浮点状态标志
(函数) [编辑]
确定已设置哪些指定的浮点状态标志
(函数) [编辑]
引发指定的浮点异常
(函数) [编辑]
从浮点环境复制指定的浮点状态标志的状态或复制到浮点环境
(函数) [编辑]
(C++11)(C++11)
获取或设置舍入方向
(函数) [编辑]
保存或恢复当前的浮点环境
(函数) [编辑]
保存环境,清除所有状态标志并忽略所有未来的错误
(函数) [编辑]
恢复浮点环境并引发先前引发的异常
(函数) [编辑]

[编辑]

浮点异常
(宏常量) [编辑]
浮点舍入方向
(宏常量) [编辑]
默认浮点环境
(宏常量) [编辑]

[编辑] 概要

#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);
}

[编辑] 缺陷报告

以下行为变更缺陷报告已追溯应用于先前发布的 C++ 标准。

DR 应用于 已发布行为 正确行为
LWG 3905 C++11 std::fexcept_t 必须是整数类型 它是一个对象类型