template<class T>
class numeric_limits {
public:
static const bool has_denorm = false;
static const bool has_denorm_loss = false;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const bool is_bounded = false;
static const bool is_exact = false;
static const bool is_iec559 = false;
static const bool is_integer = false;
static const bool is_modulo = false;
static const bool is_signed = false;
static const bool is_specialized = false;
static const bool tinyness_before = false;
static const bool traps = false;
static const float_round_style round_style = round_toward_zero;
static const int digits = 0;
static const int digits10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int radix = 0;
static T denorm_min() throw();
static T epsilon() throw();
static T infinity() throw();
static T max() throw();
static T min() throw();
static T quiet_NaN() throw();
static T round_error() throw();
static T signaling_NaN() throw();
};
The template class describes many arithmetic properties of its parameter type T
. The header defines explicit
specializations for the types wchar_t
, bool, char, signed char, unsigned char, short, unsigned short, int, unsigned
int, long, unsigned long, float, double, and long double. For all these explicit specializations, the member
is_specialized
is true, and all relevant members have meaningful values. The program can supply additional explicit
specializations.
For an arbitrary specialization, no members have meaningful values. A member object that does not have a meaningful
value stores zero (or false) and a member function that does not return a meaningful value returns T(0)
.
See the related numeric_limits sample program.