numeric_limits::digits10
Returns the number of decimal digits that the type can represent without loss of precision.
static const int digits10 = 0;
Return Value
The number of decimal digits that the type can represent without loss of precision.
Example
// numeric_limits_digits10.cpp
// compile with: /EHsc
#include <iostream>
#include <limits>
using namespace std;
int main( )
{
cout << numeric_limits<float>::digits10 <<endl;
cout << numeric_limits<double>::digits10 <<endl;
cout << numeric_limits<long double>::digits10 <<endl;
cout << numeric_limits<int>::digits10 <<endl;
cout << numeric_limits<__int64>::digits10 <<endl;
float f = (float)99999999;
cout.precision ( 10 );
cout << "The float is; " << f << endl;
}
6 15 15 9 18 The float is; 100000000
Requirements
Header: <limits>
Namespace: std