std::numeric_limits (3) - Linux Manuals
std::numeric_limits: std::numeric_limits
NAME
std::numeric_limits - std::numeric_limits
Synopsis
Defined in header <limits>
template< class T > class numeric_limits;
The numeric_limits class template provides a standardized way to query various properties of arithmetic types (e.g. the largest possible value for type int is std::numeric_limits<int>::max()).
This information is provided via specializations of the numeric_limits template. The standard library makes available specializations for all arithmetic types:
Defined in header <limits>
template<> class numeric_limits<bool>;
template<> class numeric_limits<char>;
template<> class numeric_limits<signed char>;
template<> class numeric_limits<unsigned char>;
template<> class numeric_limits<wchar_t>;
template<> class numeric_limits<char8_t>; // C++20 feature
template<> class numeric_limits<char16_t>; // C++11 feature
template<> class numeric_limits<char32_t>; // C++11 feature
template<> class numeric_limits<short>;
template<> class numeric_limits<unsigned short>;
template<> class numeric_limits<int>;
template<> class numeric_limits<unsigned int>;
template<> class numeric_limits<long>;
template<> class numeric_limits<unsigned long>;
template<> class numeric_limits<long long>;
template<> class numeric_limits<unsigned long long>;
template<> class numeric_limits<float>;
template<> class numeric_limits<double>;
template<> class numeric_limits<long double>;
Additionally, a specialization exists for every cv-qualified version of each arithmetic type, identical to the unqualified specialization, e.g. std::numeric_limits<const int>, std::numeric_limits<volatile int>, and std::numeric_limits<const volatile int> are provided and are equivalent to std::numeric_limits<int>.
The standard library types that are aliases of arithmetic types (such as std::size_t or std::streamsize) may also be examined with the std::numeric_limits type traits.
Non-arithmetic standard types, such as std::complex<T> or std::nullptr_t, do not have specializations.
Implementations may provide specializations of std::numeric_limits for implementation-specific types: e.g. GCC provides std::numeric_limits<__int128>. Non-standard libraries may add_specializations for library-provided types, e.g. OpenEXR provides std::numeric_limits<half> for a 16-bit floating-point type.
Template parameters
T - a type to retrieve numeric properties for
Member constants
is_specialized identifies types for which std::numeric_limits is specialized
[static]
is_signed identifies signed types
[static]
is_integer identifies integer types
[static]
is_exact identifies exact types
[static]
has_infinity identifies floating-point types that can represent the special value "positive infinity"
[static]
has_quiet_NaN identifies floating-point types that can represent the special value "quiet not-a-number" (NaN)
[static]
has_signaling_NaN identifies floating-point types that can represent the special value "signaling not-a-number" (NaN)
[static]
has_denorm identifies the denormalization style used by the floating-point type
[static]
has_denorm_loss identifies the floating-point types that detect loss of precision as denormalization loss rather than inexact result
[static]
round_style identifies the rounding style used by the type
[static]
is_iec559 identifies the IEC 559/IEEE 754 floating-point types
[static]
is_bounded identifies types that represent a finite set of values
[static]
is_modulo identifies types that handle overflows with modulo arithmetic
[static]
digits number of radix digits that can be represented without change
[static]