numeric_limits::is_exact
Sprawdza, czy obliczenia wykonane w danym typie są wolne od błędów zaokrągleń.
static const bool is_exact = false;
Wartość zwracana
TRUE Jeśli obliczenia są wolne od zaokrąglania błędy; false Jeśli nie.
Uwagi
Wszystkie typy wstępnie zdefiniowanych całkowitą posiadają przedstawicielstwa dokładne ich wartości i powrócić false.Reprezentacja stałoprzecinkowych lub racjonalne jest również uważane za dokładne, ale nie jest reprezentacji zmiennoprzecinkowej.
Przykład
// 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;
}
Wymagania
Nagłówek:<limity>
Przestrzeń nazw: std