Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

21.3 numeric_limits 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

Table 22 summarizes the information available through the numeric_limits static member data fields and functions.

Table 22 -- Information available through numeric_limits

TypeNameMeaning  
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 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.

Table 23 -- Members specific to floating point values

TypeNameMeaning 
T
min()
Minimum positive normalized value
int
digits
Number of digits in the mantissa
int
radix
Base (or radix) of the exponent representation
T
epsilon()
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 \Q\QNot 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 datatype, the value in field radix, which represents the base of the exponential representation, is equivalent to the symbolic constant FLT_RADIX.

For the types floatdouble, 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.

The 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.



Previous fileTop of DocumentContentsIndexNext file

OEM Edition, OEM Edition, ©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.