为什么以下代码在使用
-1
g++ -O1
#include <iostream> #include <cmath> #include <cfenv> using namespace std; int main() { fesetround(FE_DOWNWARD); cout << rint(-1.6) << endl; return 0; }
对于 GCC,如果您的程序
可能动态更改 FP 舍入模式,或者可能以非默认舍入模式执行,则应使用
-frounding-math