numeric_limits::is_exact
測試,以便在完成型別的計算釋放進位誤差。
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;
}
需求
標題: <limits>
命名空間: std