测试,如果在类型的计算完成释放舍入误差。
static const bool is_exact = false;
返回值
true,如果计算免于舍入误差;false,则不是。
备注
所有的预定义整数类型都有自己的值并返回 false的精确表示形式。 一个固定点或合理的表示也视为完全,但一个浮点表示形式不是。
示例
// numeric_limits_is_exact.cpp
// compile with: /EHsc
#include <iostream>
#include <limits>
using namespace std;
int main( )
{
cout << "Whether float objects have calculations "
<< "free of rounding errors: "
<< numeric_limits<float>::is_exact
<< endl;
cout << "Whether double objects have calculations "
<< "free of rounding errors: "
<< numeric_limits<double>::is_exact
<< endl;
cout << "Whether long int objects have calculations "
<< "free of rounding errors: "
<< numeric_limits<long int>::is_exact
<< endl;
cout << "Whether unsigned char objects have calculations "
<< "free of rounding errors: "
<< numeric_limits<unsigned char>::is_exact
<< endl;
}
要求
页眉: <限制>
命名空间: std