Personal tools
21.3 Numeric Limit Members
Click on the banner to return to the user guide home page.
21.3 Numeric Limit Members
Since a number of the fields in the numeric_limits structure are meaningful only for floating point values, it is useful to separate the description of the members into common fields and floating-point specific fields.
21.3.1 Members Common to All Types
The following table summarizes the information available through the numeric_limits static member data fields and functions.
Type |
Name |
Meaning |
bool |
is_specialized |
true if a specialization exists, false otherwise |
T |
min() |
smallest finite value |
T |
max() |
largest finite value |
int |
radix |
the base of the representation |
int |
digits |
number of radix digits that can be represented without change |
int |
digits10 |
number of base-10 digits that can be represented without change |
bool |
is_signed |
true if the type is signed |
bool |
is_integer |
true if the type is integer |
bool |
is_exact |
true if the representation is exact |
bool |
is_bounded |
true if representation is finite |
bool |
is_modulo |
true if type is modulo |
bool |
traps |
true if trapping is implemented for the type |
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 field 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 package that would not be bounded.
A type is modulo if the value resulting from the addition of two values can wrap around, that is, be smaller than either argument. The fundamental unsigned integer types are all modulo.
21.3.2 Members Specific to Floating Point Values
The following members 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 data types.
Type |
Name |
Meaning |
T |
min() |
the minimum positive normalized value |
int |
digits |
the number of digits in the mantissa |
int |
radix |
the base (or radix) of the exponent representation |
T |
epsilon() |
the difference between 1 and the least representable value greater than 1 |
T |
round_error() |
a measurement of the rounding error |
int |
min_exponent |
minimum negative exponent |
int |
min_exponent10 |
minimum value such that 10 raised to that power is in range |
int |
max_exponent |
maximum positive exponent |
int |
max_exponent10 |
maximum value such that 10 raised to that power is in range |
bool |
has_infinity |
true if the type has a representation of positive infinity |
T |
infinity() |
representation of infinity, if available |
bool |
has_quiet_NaN |
true if there is a representation of a quiet ``Not a Number" |
T |
quiet_NaN() |
representation of quiet NaN, if available |
bool |
has_signaling_NaN |
true if there is a representation for a signaling NaN |
T |
signaling_NaN() |
representation of signaling NaN, if available |
bool |
has_denorm |
true if the representation allows denormalized values |
T |
denorm_min() |
Minimum positive denormalized value |
bool |
is_iec559 |
true if representation adheres to IEC 559 standard. |
bool |
tinyness_before |
true if tinyness is detected before rounding |
round_style |
rounding style for type |
For the float data type, the value in field radix, which represents the base of the exponential representation, is equivalent to the symbolic constant FLT_RADIX.
For the types float, double and long double the value of epsilon is also available as FLT_EPSILON, DBL_EPSILON, and LDBL_EPSILON.
A NaN is a "Not a Number." It is a representable value that nevertheless does not correspond to any numeric quantity. Many numeric algorithms manipulate such values.
The IEC 559 standard is a standard approved by the International Electrotechnical Commission. It is the same as the IEEE standard 754.
Value returned by the function round_style() is one of the following: round_indeterminate, round_toward_zero, round_to_nearest, round_toward_infinity, or round_toward_neg_infinity.
©Copyright 1996, Rogue Wave Software, Inc.