Share via


numeric_limits Class

The template class describes arithmetic properties of built-in numerical types.

template<classType> class numeric_limits

Parameters

  • Type
    The fundamental element data type whose properties are being tested or queried or set.

Remarks

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, long double**,** long long, unsigned long long, char16_t, and char32_t. For these explicit specializations, the member numeric_limits::is_specialized is true, and all relevant members have meaningful values. The program can supply additional explicit specializations. Most member functions of the class describe or test possible implementations of float.

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

Static Functions and Constants

denorm_min

Returns the smallest nonzero denormalized value.

digits

Returns the number of radix digits that the type can represent without loss of precision.

digits10

Returns the number of decimal digits that the type can represent without loss of precision.

epsilon

Returns the difference between 1 and the smallest value greater than 1 that the data type can represent.

has_denorm

Tests whether a type allows denormalized values.

has_denorm_loss

Tests whether loss of accuracy is detected as a denormalization loss rather than as an inexact result.

has_infinity

Tests whether a type has a representation for positive infinity.

has_quiet_NaN

Tests whether a type has a representation for a quiet not a number (NAN), which is nonsignaling.

has_signaling_NaN

Tests whether a type has a representation for signaling not a number (NAN).

infinity

The representation for positive infinity for a type, if available.

is_bounded

Tests if the set of values that a type may represent is finite.

is_exact

Tests if the calculations done on a type are free of rounding errors.

is_iec559

Tests if a type conforms to IEC 559 standards.

is_integer

Tests if a type has an integer representation.

is_modulo

Tests if a type has a modulo representation.

is_signed

Tests if a type has a signed representation.

is_specialized

Tests if a type has an explicit specialization defined in the template class numeric_limits.

lowest

Returns the most negative finite value.

max

Returns the maximum finite value for a type.

max_digits10

Returns the number of decimal digits required to ensure that two distinct values of the type have distinct decimal representations.

max_exponent

Returns the maximum positive integral exponent that the floating-point type can represent as a finite value when a base of radix is raised to that power.

max_exponent10

Returns the maximum positive integral exponent that the floating-point type can represent as a finite value when a base of ten is raised to that power.

min

Returns the minimum normalized value for a type.

min_exponent

Returns the maximum negative integral exponent that the floating-point type can represent as a finite value when a base of radix is raised to that power.

min_exponent10

Returns the maximum negative integral exponent that the floating-point type can represent as a finite value when a base of ten is raised to that power.

quiet_NaN

Returns the representation of a quiet not a number (NAN) for the type.

radix

Returns the integral base, referred to as radix, used for the representation of a type.

round_error

Returns the maximum rounding error for the type.

round_style

Returns a value that describes the various methods that an implementation can choose for rounding a floating-point value to an integer value.

signaling_NaN

Returns the representation of a signaling not a number (NAN) for the type.

tinyness_before

Tests whether a type can determine that a value is too small to represent as a normalized value before rounding it.

traps

Tests whether trapping that reports on arithmetic exceptions is implemented for a type.

Requirements

Header: <limits>

Namespace: std

See Also

Reference

Thread Safety in the C++ Standard Library