Export (0) Print
Expand All

numeric_limits::round_error

Returns the maximum rounding error for the type.

static Type round_error( ) throw( );

Return Value

The maximum rounding error for the type.

Example

// numeric_limits_round_error.cpp
// compile with: /EHsc
#include <iostream>
#include <limits>

using namespace std;

int main( )
{
   cout << "The maximum rounding error for type float is:  "
        << numeric_limits<float>::round_error( )
        << endl;
   cout << "The maximum rounding error for type int is:  "
        << numeric_limits<int>::round_error( )
        << endl;
   cout << "The maximum rounding error for type long double is:  "
        << numeric_limits<long double>::round_error( )
        << endl;
}

Output

The maximum rounding error for type float is:  0.5
The maximum rounding error for type int is:  0
The maximum rounding error for type long double is:  0.5

See Also

strstreambuf Class | numeric_limits Members

Show:
© 2014 Microsoft