使用 i686-apple-darwin10-g++-4.2.1 在 Mac OS X 10.6.2、Intel 上工作,并使用 -arch x86_64 标志进行编译,我只是注意到虽然......
std::numeric_limits<long double>::max_exponent10 = 4932
...正如预期的那样,当 long double 实际上设置为指数大于 308 的值时,它变为 inf——即实际上它只有 64 位精度而不是 80 位。
此外,sizeof()
显示长双精度为 16 个字节,它们应该是。
最后, using<limits.h>
给出与 相同的结果<limits>
。
有谁知道差异可能在哪里?
long double x = 1e308, y = 1e309;
cout << std::numeric_limits<long double>::max_exponent10 << endl;
cout << x << '\t' << y << endl;
cout << sizeof(x) << endl;
给
4932
1e+308 inf
16