共用方式為


numeric_limits::digits

Returns the number of radix digits that the type can represent without loss of precision.

static const int digits = 0;

Return Value

The number of radix digits that the type can represent without loss of precision.

Remarks

The member stores the number of radix digits that the type can represent without change, which is the number of bits other than any sign bit for a predefined integer type, or the number of mantissa digits for a predefined floating-point type.

Example

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

using namespace std;

int main( )
{
   cout << numeric_limits<float>::digits <<endl;
   cout << numeric_limits<double>::digits <<endl;
   cout << numeric_limits<long double>::digits <<endl;
   cout << numeric_limits<int>::digits <<endl;
   cout << numeric_limits<__int64>::digits <<endl;
}
24
53
53
31
63

Requirements

Header: <limits>

Namespace: std

See Also

Reference

strstreambuf Class