标准库头文件 <cfenv> (C++11)
来自 cppreference.cn
此头文件最初在 C 标准库中为 <fenv.h>。
此头文件是浮点环境库的一部分。
目录 |
[编辑] 类型
fenv_t (C++11) |
表示整个浮点环境的类型 (typedef) |
fexcept_t (C++11) |
表示所有浮点状态标志的集合的类型 (typedef) |
[编辑] 函数
(C++11) |
清除指定的浮点状态标志 (函数) |
(C++11) |
确定已设置哪些指定的浮点状态标志 (函数) |
(C++11) |
引发指定的浮点异常 (函数) |
(C++11)(C++11) |
从浮点环境复制指定的浮点状态标志的状态或复制到浮点环境 (函数) |
(C++11)(C++11) |
获取或设置舍入方向 (函数) |
(C++11) |
保存或恢复当前的浮点环境 (函数) |
(C++11) |
保存环境,清除所有状态标志并忽略所有未来的错误 (函数) |
(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 必须是整数类型 |
它是一个对象类型 |