C++11 中是否存在 C99 中的 fenv.h?还有其他方法可以使用fesetround之类的功能吗?也许提升?
gcc 4.7.2 编译这段代码:
#include <cfenv>
int main() {}
http://liveworkspace.org/code/ffbd8e8a24633c7e74f7bcead3b1a287
最佳答案
Does
fenv.h
fromC99
exists inC++11
?
是的。
引用:
26.3 The floating-point environment [cfenv]
Standard C++11 26.3.1 Header <cfenv> synopsis [cfenv.syn]
Is there any other ways to use function like
fesetround()
? Maybe boost?
fesetround()
函数已经由 C++11 中的 cfenv
提供。
此外,fenv.h
也存在于 C++11 中,以便向后兼容 c 标准头文件。它涵盖在:
D.5 C standard library headers [depr.c.headers]
What is the difference between using
fenv.h
orcfenv
?
包含 cfenv
会在 std
命名空间和可能 全局命名空间中导入符号名称。
包含 fenv.h
会在全局命名空间中导入符号名称,并且可能会在 std
命名空间中导入符号名称。
关于c++ - 来自 C++11 中 C99 的 fenv.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12667409/