numeric_limits::is_exact
Tests if the calculations done on a type are free of rounding errors.
static const bool is_exact = false;
Return Value
true if the calculations are free of rounding errors; false if not.
Remarks
All predefined integer types have exact representations for their values and return false. A fixed-point or rational representation is also considered exact, but a floating-point representation is not.
Example
// 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;
}
Whether float objects have calculations free of rounding errors: 0 Whether double objects have calculations free of rounding errors: 0 Whether long int objects have calculations free of rounding errors: 1 Whether unsigned char objects have calculations free of rounding errors: 1
Requirements
Header: <limits>
Namespace: std