Files
2025-10-25 03:02:53 +03:00

3.7 KiB

[numeric.limits.general]

17 Language support library [support]

17.3 Implementation properties [support.limits]

17.3.5 Class template numeric_limits [numeric.limits]

17.3.5.1 General [numeric.limits.general]

1

#

Thenumeric_limits class template provides a C++ program with information about various properties of the implementation's representation of the arithmetic types.

🔗

namespace std {template class numeric_limits {public:static constexpr bool is_specialized = false; static constexpr T min() noexcept { return T(); }static constexpr T max() noexcept { return T(); }static constexpr T lowest() noexcept { return T(); }static constexpr int digits = 0; static constexpr int digits10 = 0; static constexpr int max_digits10 = 0; static constexpr bool is_signed = false; static constexpr bool is_integer = false; static constexpr bool is_exact = false; static constexpr int radix = 0; static constexpr T epsilon() noexcept { return T(); }static constexpr T round_error() noexcept { return T(); }static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr T infinity() noexcept { return T(); }static constexpr T quiet_NaN() noexcept { return T(); }static constexpr T signaling_NaN() noexcept { return T(); }static constexpr T denorm_min() noexcept { return T(); }static constexpr bool is_iec559 = false; static constexpr bool is_bounded = false; static constexpr bool is_modulo = false; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; };}

2

#

For all members declaredstatic constexpr in thenumeric_limits template, specializations shall define these values in such a way that they are usable as constant expressions.

3

#

For thenumeric_limits primary template, all data members are value-initialized and all member functions return a value-initialized object.

[Note 1:

This means all members have zero or false values unless numeric_limits is specialized for a type.

— end note]

4

#

Specializations shall be provided for each arithmetic type, both floating-point and integer, includingbool.

The memberis_specialized shall betrue for all such specializations ofnumeric_limits.

5

#

The value of each member of a specialization ofnumeric_limits on a cv-qualified typecv T shall be equal to the value of the corresponding member of the specialization on the unqualified type T.

6

#

Non-arithmetic standard types, such ascomplex, shall not have specializations.