`<limits>`

Include the standard header ** <limits>**
to define the template class

`numeric_limits`

.
Explicit specializations of this class describe many arithmetic properties
of the scalar types (other than pointers).namespace std { enumfloat_denorm_style; enumfloat_round_style; template<class Ty> classnumeric_limits; };

`float_denorm_style`

enum float_denorm_style {denorm_indeterminate= -1,denorm_absent= 0,denorm_present= 1 };

The enumeration describes the various methods that an implementation can choose for representing a denormalized floating-point value -- one too small to represent as a normalized value:

`denorm_indeterminate`

`denorm_absent`

`denorm_present`

`float_round_style`

enum float_round_style {round_indeterminate= -1,round_toward_zero= 0,round_to_nearest= 1,round_toward_infinity= 2,round_toward_neg_infinity= 3 };

The enumeration describes the various methods that an implementation can choose for rounding a floating-point value to an integer value:

`round_indeterminate`

`round_toward_zero`

`round_to_nearest`

`round_toward_infinity`

`round_toward_neg_infinity`

`numeric_limits`

template<class Ty> class numeric_limits { public: static const float_denorm_stylehas_denorm= denorm_absent; static const boolhas_denorm_loss= false; static const boolhas_infinity= false; static const boolhas_quiet_NaN= false; static const boolhas_signaling_NaN= false; static const boolis_bounded= false; static const boolis_exact= false; static const boolis_iec559= false; static const boolis_integer= false; static const boolis_modulo= false; static const boolis_signed= false; static const boolis_specialized= false; static const booltinyness_before= false; static const booltraps= false; static const float_round_styleround_style= round_toward_zero; static const intdigits= 0; static const intdigits10= 0; static const intmax_exponent= 0; static const intmax_exponent10= 0; static const intmin_exponent= 0; static const intmin_exponent10= 0; static const intradix= 0; static Tydenorm_min() throw(); static Tyepsilon() throw(); static Tyinfinity() throw(); static Tymax() throw(); static Tymin() throw(); static Tyquiet_NaN() throw(); static Tyround_error() throw(); static Tysignaling_NaN() throw(); };

The template class describes many arithmetic properties of its
parameter type `Ty`

. 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 `Ty(0)`

.

`numeric_limits::denorm_min`

static Tydenorm_min() throw();

The function returns the minimum value for the type
(which is the same as
`min`

() if
`has_denorm`

is
not equal to
`denorm_present`

).

`numeric_limits::digits`

static const intdigits= 0;

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

`numeric_limits::digits10`

static const intdigits10= 0;

The member stores the number of decimal digits that the type can represent without change.

`numeric_limits::epsilon`

static Tyepsilon() throw();

The function returns the difference between 1 and the smallest
value greater than 1 that is representable for the type
(which is the value
`FLT_EPSILON`

for type *float*).

`numeric_limits::has_denorm`

static const float_denorm_stylehas_denorm= denorm_absent;

The member stores
`denorm_present`

for a floating-point type that has
denormalized values (effectively a variable number of exponent bits).

`numeric_limits::has_denorm_loss`

static const boolhas_denorm_loss= false;

The member stores true for a type that determines whether a value has lost accuracy because it is delivered as a denormalized result (too small to represent as a normalized value) or because it is inexact (not the same as a result not subject to limitations of exponent range and precision), an option with IEC 559 floating-point representations that can affect some results.

`numeric_limits::has_infinity`

static const boolhas_infinity= false;

The member stores true for a type that has
a representation for positive infinity.
True if `is_iec559`

is true.

`numeric_limits::has_quiet_NaN`

static const boolhas_quiet_NaN= false;

The member stores true for a type that has
a representation for a **quiet NaN**,
an encoding that is ``Not a Number'' which does not
signal its presence in an expression.
True if `is_iec559`

is true.

`numeric_limits::has_signaling_NaN`

static const boolhas_signaling_NaN= false;

The member stores true for a type that has
a representation for a **signaling NaN**,
an encoding that is ``Not a Number'' which
signals its presence in an expression
by reporting an exception.
True if `is_iec559`

is true.

`numeric_limits::infinity`

static Tyinfinity() throw();

The function returns the representation of positive infinity
for the type. The return value is meaningful only if
`has_infinity`

is true.

`numeric_limits::is_bounded`

static const boolis_bounded= false;

The member stores true for a type that has a bounded set of representable values (which is the case for all predefined types).

`numeric_limits::is_exact`

static const boolis_exact= false;

The member stores true for a type that has exact representations for all its values (which is the case for all predefined integer types). A fixed-point or rational representation is also considered exact, but not a floating-point representation.

`numeric_limits::is_iec559`

static const boolis_iec559= false;

The member stores true for a type that has
a representation conforming to
**IEC 559**, an international
standard for representing floating-point values (also known as
**IEEE 754** in the USA).

`numeric_limits::is_integer`

static const boolis_integer= false;

The member stores true for a type that has an integer representation (which is the case for all predefined integer types).

`numeric_limits::is_modulo`

static const boolis_modulo= false;

The member stores true for a type that has a
**modulo representation**,
where all results are reduced modulo some value (which is the
case for all predefined unsigned integer types).

`numeric_limits::is_signed`

static const boolis_signed= false;

The member stores true for a type that has a signed representation (which is the case for all predefined floating-point and signed integer types).

`numeric_limits::is_specialized`

static const boolis_specialized= false;

The member stores true for a type that has
an explicit specialization defined for template class
`numeric_limits`

(which is the case for all scalar types other than pointers).

`numeric_limits::max`

static Tymax() throw();

The function returns the maximum finite value for the type
(which is
`INT_MAX`

for type *int* and
`FLT_MAX`

for type *float*). The return value is meaningful if
`is_bounded`

is true.

`numeric_limits::max_exponent`

static const intmax_exponent= 0;

The member stores the maximum positive integer such that
the type can represent as a finite value
`radix`

raised to that power
(which is the value
`FLT_MAX_EXP`

for type *float*).
Meaningful only for floating-point types.

`numeric_limits::max_exponent10`

static const intmax_exponent10= 0;

The member stores the maximum positive integer such that
the type can represent as a finite value
10 raised to that power (which is the value
`FLT_MAX_10_EXP`

for type *float*).
Meaningful only for floating-point types.

`numeric_limits::min`

static Tymin() throw();

The function returns the minimum normalized value for the type
(which is
`INT_MIN`

for type *int* and
`FLT_MIN`

for type *float*). The return value is meaningful if
`is_bounded`

is true or
`is_bounded`

is false and
`is_signed`

is false.

`numeric_limits::min_exponent`

static const intmin_exponent= 0;

The member stores the minimum negative integer such that
the type can represent as a normalized value
`radix`

raised to that power
(which is the value
`FLT_MIN_EXP`

for type *float*).
Meaningful only for floating-point types.

`numeric_limits::min_exponent10`

static const intmin_exponent10= 0;

The member stores the minimum negative integer such that
the type can represent as a normalized value
10 raised to that power
(which is the value
`FLT_MIN_10_EXP`

for type *float*).
Meaningful only for floating-point types.

`numeric_limits::quiet_NaN`

static Tyquiet_NaN() throw();

The function returns a representation of a
quiet NaN
for the type. The return value is meaningful only if
`has_quiet_NaN`

is true.

`numeric_limits::radix`

static const intradix= 0;

The member stores the base of the representation
for the type (which is 2 for the predefined integer types,
and the base to which the exponent is raised, or
`FLT_RADIX`

,
for the predefined floating-point types).

`numeric_limits::round_error`

static Tyround_error() throw();

The function returns the maximum rounding error for the type.

`numeric_limits::round_style`

static const float_round_styleround_style= round_toward_zero;

The member stores a value that describes the vaious methods that an implementation can choose for rounding a floating-point value to an integer value.

`numeric_limits::signaling_NaN`

static Tysignaling_NaN() throw();

The function returns a representation of a
signaling NaN
for the type. The return value is meaningful only if
`has_signaling_NaN`

is true.

`numeric_limits::tinyness_before`

static const booltinyness_before= false;

The member stores true for a type that determines whether a value is ``tiny'' (too small to represent as a normalized value) before rounding, an option with IEC 559 floating-point representations that can affect some results.

`numeric_limits::traps`

static const booltraps= false;

The member stores true for a type that generates some kind of signal to report certain arithmetic exceptions.

See also the
**Table of Contents** and the
**Index**.

*
Copyright © 1992-2002
by P.J. Plauger. All rights reserved.*