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

参照

関連項目

strstreambuf Class