Since a number of the members in the numeric_limits template specializations are meaningful only for floating point specializations, it is useful to separate the description of the members into common fields and floating-point specific fields.
Table 22 summarizes the information available through the numeric_limits static data members and functions.
true if a specialization exists, false otherwise
Smallest finite value
Largest finite value
The base of the representation
Number of radix digits that can be represented without change
Number of base-10 digits that can be represented without change
true if the type is signed
true if the type is integer
true if the representation is exact
true if representation is finite
true if adding two positive values of type T can yield a result less than either value
true if trapping is implemented for the type
In the table above, the XXX prefix is replaced with CHAR, SCHAR, UCHAR, SHRT, USHRT, INT, UINT, LONG, and ULONG, respectively, for the corresponding values of types char, signed char, unsigned char, short, unsigned short, int, unsigned, long, and unsigned long, as appropriate. These manifest constants are defined in the header <climits>.
radix represents the internal base for the representation. For example, most machines use a base 2 radix for integer data values; however, some may also support a representation, such as BCD, that uses a different base. The digits member then represents the number of such radix values that can be held in a value. For an integer type, this would be the number of non-sign bits in the representation.
All fundamental types are bounded. However, an implementation might choose to include, for example, an infinite precision integer type that would not be bounded.
A type is modulo if the value resulting from the addition of two positive values can wrap around, that is, be smaller than either argument. The fundamental unsigned integer types are all modulo. Signed integer types are usually modulo. The fundamental floating point types typically are not modulo.
The members described in Table 23 are either specific to floating point values, or have a meaning slightly different for floating point values than the one described earlier for non-floating datatypes.
Minimum positive normalized value
Number of digits in the mantissa
Base (or radix) of the exponent representation
Difference between 1 and the least representable value greater than 1
A measurement of the rounding error
Minimum negative exponent
Minimum value such that 10 raised to that power is in range
Maximum positive exponent
Maximum value such that 10 raised to that power is in range
true if the type has a representation of positive infinity
Representation of infinity, if available
true if there is a representation of a Quiet \Q\QNot a Number"
Representation of Quiet NaN, if available
true if there is a representation for a Signaling NaN
Representation of Signaling NaN, if available
true if the representation allows denormalized values
Minimum positive denormalized value
true if representation adheres to IEC 559 standard.
true if tinyness is detected before rounding
Rounding style for type
In the table above, the XXX prefix is replaced with FLT, DBL, and LDBL, respectively, for the corresponding values of types float, double, and long double. These manifest constants are defined in the header <cfloat>.
A NaN is a Not a Number. It is a set of representable values that nevertheless do not correspond to any numeric quantity. Many numeric algorithms manipulate such values. NANs are typically returned by numeric algorithms to indicate a result that is outside of the domain of the data type. For instance, the operations 0.0/0.0 or 0 * std::numeric_limits<double>::infinity() yield NAN or std::numeric_limits<double>::quiet_NaN(). NANs come in two flavors: quiet and signaling. A quiet NAN can be safely used in computations without the danger of triggering an exception. A signaling NAN can be copied, assigned, and compared without causing an exception; however, using it in an arithmetic expression triggers a hardware exception. A unique property of all NANs is that they do not compare equal to any number, including another NAN.
The IEC 559 standard is a standard approved by the International Electrotechnical Commission. It is the same as the IEEE standard 754. The standard precisely specifies the representation, many properties, and relationships of the fundamental floating point types.
The value returned by the member function round_style() is one of the following: round_indeterminate, round_toward_zero, round_to_nearest, round_toward_infinity, or round_toward_neg_infinity.