Warning, /include/c++/v1/limits is written in an unsupported language. File is not indexed.
0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009
0010 #ifndef _LIBCPP_LIMITS
0011 #define _LIBCPP_LIMITS
0012
0013 /*
0014 limits synopsis
0015
0016 namespace std
0017 {
0018
0019 template<class T>
0020 class numeric_limits
0021 {
0022 public:
0023 static constexpr bool is_specialized = false;
0024 static constexpr T min() noexcept;
0025 static constexpr T max() noexcept;
0026 static constexpr T lowest() noexcept;
0027
0028 static constexpr int digits = 0;
0029 static constexpr int digits10 = 0;
0030 static constexpr int max_digits10 = 0;
0031 static constexpr bool is_signed = false;
0032 static constexpr bool is_integer = false;
0033 static constexpr bool is_exact = false;
0034 static constexpr int radix = 0;
0035 static constexpr T epsilon() noexcept;
0036 static constexpr T round_error() noexcept;
0037
0038 static constexpr int min_exponent = 0;
0039 static constexpr int min_exponent10 = 0;
0040 static constexpr int max_exponent = 0;
0041 static constexpr int max_exponent10 = 0;
0042
0043 static constexpr bool has_infinity = false;
0044 static constexpr bool has_quiet_NaN = false;
0045 static constexpr bool has_signaling_NaN = false;
0046 static constexpr float_denorm_style has_denorm = denorm_absent; // deprecated in C++23
0047 static constexpr bool has_denorm_loss = false; // deprecated in C++23
0048 static constexpr T infinity() noexcept;
0049 static constexpr T quiet_NaN() noexcept;
0050 static constexpr T signaling_NaN() noexcept;
0051 static constexpr T denorm_min() noexcept;
0052
0053 static constexpr bool is_iec559 = false;
0054 static constexpr bool is_bounded = false;
0055 static constexpr bool is_modulo = false;
0056
0057 static constexpr bool traps = false;
0058 static constexpr bool tinyness_before = false;
0059 static constexpr float_round_style round_style = round_toward_zero;
0060 };
0061
0062 enum float_round_style
0063 {
0064 round_indeterminate = -1,
0065 round_toward_zero = 0,
0066 round_to_nearest = 1,
0067 round_toward_infinity = 2,
0068 round_toward_neg_infinity = 3
0069 };
0070
0071 enum float_denorm_style // deprecated in C++23
0072 {
0073 denorm_indeterminate = -1,
0074 denorm_absent = 0,
0075 denorm_present = 1
0076 };
0077
0078 template<> class numeric_limits<cv bool>;
0079
0080 template<> class numeric_limits<cv char>;
0081 template<> class numeric_limits<cv signed char>;
0082 template<> class numeric_limits<cv unsigned char>;
0083 template<> class numeric_limits<cv wchar_t>;
0084 template<> class numeric_limits<cv char8_t>; // C++20
0085 template<> class numeric_limits<cv char16_t>;
0086 template<> class numeric_limits<cv char32_t>;
0087
0088 template<> class numeric_limits<cv short>;
0089 template<> class numeric_limits<cv int>;
0090 template<> class numeric_limits<cv long>;
0091 template<> class numeric_limits<cv long long>;
0092 template<> class numeric_limits<cv unsigned short>;
0093 template<> class numeric_limits<cv unsigned int>;
0094 template<> class numeric_limits<cv unsigned long>;
0095 template<> class numeric_limits<cv unsigned long long>;
0096
0097 template<> class numeric_limits<cv float>;
0098 template<> class numeric_limits<cv double>;
0099 template<> class numeric_limits<cv long double>;
0100
0101 } // std
0102
0103 */
0104
0105 #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0106 # include <__cxx03/limits>
0107 #else
0108 # include <__config>
0109 # include <__type_traits/is_arithmetic.h>
0110 # include <__type_traits/is_signed.h>
0111 # include <__type_traits/remove_cv.h>
0112
0113 # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0114 # pragma GCC system_header
0115 # endif
0116
0117 _LIBCPP_PUSH_MACROS
0118 # include <__undef_macros>
0119 # include <version>
0120
0121 _LIBCPP_BEGIN_NAMESPACE_STD
0122
0123 enum float_round_style {
0124 round_indeterminate = -1,
0125 round_toward_zero = 0,
0126 round_to_nearest = 1,
0127 round_toward_infinity = 2,
0128 round_toward_neg_infinity = 3
0129 };
0130
0131 enum _LIBCPP_DEPRECATED_IN_CXX23 float_denorm_style {
0132 denorm_indeterminate = -1,
0133 denorm_absent = 0,
0134 denorm_present = 1
0135 };
0136
0137 template <class _Tp, bool = is_arithmetic<_Tp>::value>
0138 class __libcpp_numeric_limits {
0139 protected:
0140 typedef _Tp type;
0141
0142 static _LIBCPP_CONSTEXPR const bool is_specialized = false;
0143 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return type(); }
0144 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return type(); }
0145 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return type(); }
0146
0147 static _LIBCPP_CONSTEXPR const int digits = 0;
0148 static _LIBCPP_CONSTEXPR const int digits10 = 0;
0149 static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
0150 static _LIBCPP_CONSTEXPR const bool is_signed = false;
0151 static _LIBCPP_CONSTEXPR const bool is_integer = false;
0152 static _LIBCPP_CONSTEXPR const bool is_exact = false;
0153 static _LIBCPP_CONSTEXPR const int radix = 0;
0154 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(); }
0155 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(); }
0156
0157 static _LIBCPP_CONSTEXPR const int min_exponent = 0;
0158 static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
0159 static _LIBCPP_CONSTEXPR const int max_exponent = 0;
0160 static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
0161
0162 static _LIBCPP_CONSTEXPR const bool has_infinity = false;
0163 static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
0164 static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
0165 static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
0166 static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
0167 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(); }
0168 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(); }
0169 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(); }
0170 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(); }
0171
0172 static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
0173 static _LIBCPP_CONSTEXPR const bool is_bounded = false;
0174 static _LIBCPP_CONSTEXPR const bool is_modulo = false;
0175
0176 static _LIBCPP_CONSTEXPR const bool traps = false;
0177 static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
0178 static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
0179 };
0180
0181 template <class _Tp, int __digits, bool _IsSigned>
0182 struct __libcpp_compute_min {
0183 static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << __digits);
0184 };
0185
0186 template <class _Tp, int __digits>
0187 struct __libcpp_compute_min<_Tp, __digits, false> {
0188 static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0);
0189 };
0190
0191 template <class _Tp>
0192 class __libcpp_numeric_limits<_Tp, true> {
0193 protected:
0194 typedef _Tp type;
0195
0196 static _LIBCPP_CONSTEXPR const bool is_specialized = true;
0197
0198 static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0);
0199 static _LIBCPP_CONSTEXPR const int digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed);
0200 static _LIBCPP_CONSTEXPR const int digits10 = digits * 3 / 10;
0201 static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
0202 static _LIBCPP_CONSTEXPR const type __min = __libcpp_compute_min<type, digits, is_signed>::value;
0203 static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
0204 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __min; }
0205 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __max; }
0206 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return min(); }
0207
0208 static _LIBCPP_CONSTEXPR const bool is_integer = true;
0209 static _LIBCPP_CONSTEXPR const bool is_exact = true;
0210 static _LIBCPP_CONSTEXPR const int radix = 2;
0211 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(0); }
0212 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(0); }
0213
0214 static _LIBCPP_CONSTEXPR const int min_exponent = 0;
0215 static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
0216 static _LIBCPP_CONSTEXPR const int max_exponent = 0;
0217 static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
0218
0219 static _LIBCPP_CONSTEXPR const bool has_infinity = false;
0220 static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
0221 static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
0222 static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
0223 static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
0224 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(0); }
0225 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(0); }
0226 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(0); }
0227 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(0); }
0228
0229 static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
0230 static _LIBCPP_CONSTEXPR const bool is_bounded = true;
0231 static _LIBCPP_CONSTEXPR const bool is_modulo = !std::is_signed<_Tp>::value;
0232
0233 # if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || defined(__wasm__)
0234 static _LIBCPP_CONSTEXPR const bool traps = true;
0235 # else
0236 static _LIBCPP_CONSTEXPR const bool traps = false;
0237 # endif
0238 static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
0239 static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
0240 };
0241
0242 template <>
0243 class __libcpp_numeric_limits<bool, true> {
0244 protected:
0245 typedef bool type;
0246
0247 static _LIBCPP_CONSTEXPR const bool is_specialized = true;
0248
0249 static _LIBCPP_CONSTEXPR const bool is_signed = false;
0250 static _LIBCPP_CONSTEXPR const int digits = 1;
0251 static _LIBCPP_CONSTEXPR const int digits10 = 0;
0252 static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
0253 static _LIBCPP_CONSTEXPR const type __min = false;
0254 static _LIBCPP_CONSTEXPR const type __max = true;
0255 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __min; }
0256 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __max; }
0257 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return min(); }
0258
0259 static _LIBCPP_CONSTEXPR const bool is_integer = true;
0260 static _LIBCPP_CONSTEXPR const bool is_exact = true;
0261 static _LIBCPP_CONSTEXPR const int radix = 2;
0262 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(0); }
0263 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(0); }
0264
0265 static _LIBCPP_CONSTEXPR const int min_exponent = 0;
0266 static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
0267 static _LIBCPP_CONSTEXPR const int max_exponent = 0;
0268 static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
0269
0270 static _LIBCPP_CONSTEXPR const bool has_infinity = false;
0271 static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
0272 static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
0273 static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
0274 static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
0275 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(0); }
0276 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(0); }
0277 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(0); }
0278 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(0); }
0279
0280 static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
0281 static _LIBCPP_CONSTEXPR const bool is_bounded = true;
0282 static _LIBCPP_CONSTEXPR const bool is_modulo = false;
0283
0284 static _LIBCPP_CONSTEXPR const bool traps = false;
0285 static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
0286 static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
0287 };
0288
0289 template <>
0290 class __libcpp_numeric_limits<float, true> {
0291 protected:
0292 typedef float type;
0293
0294 static _LIBCPP_CONSTEXPR const bool is_specialized = true;
0295
0296 static _LIBCPP_CONSTEXPR const bool is_signed = true;
0297 static _LIBCPP_CONSTEXPR const int digits = __FLT_MANT_DIG__;
0298 static _LIBCPP_CONSTEXPR const int digits10 = __FLT_DIG__;
0299 static _LIBCPP_CONSTEXPR const int max_digits10 = 2 + (digits * 30103l) / 100000l;
0300 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __FLT_MIN__; }
0301 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __FLT_MAX__; }
0302 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); }
0303
0304 static _LIBCPP_CONSTEXPR const bool is_integer = false;
0305 static _LIBCPP_CONSTEXPR const bool is_exact = false;
0306 static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
0307 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __FLT_EPSILON__; }
0308 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5F; }
0309
0310 static _LIBCPP_CONSTEXPR const int min_exponent = __FLT_MIN_EXP__;
0311 static _LIBCPP_CONSTEXPR const int min_exponent10 = __FLT_MIN_10_EXP__;
0312 static _LIBCPP_CONSTEXPR const int max_exponent = __FLT_MAX_EXP__;
0313 static _LIBCPP_CONSTEXPR const int max_exponent10 = __FLT_MAX_10_EXP__;
0314
0315 static _LIBCPP_CONSTEXPR const bool has_infinity = true;
0316 static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
0317 static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
0318 static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
0319 static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
0320 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {
0321 return __builtin_huge_valf();
0322 }
0323 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {
0324 return __builtin_nanf("");
0325 }
0326 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {
0327 return __builtin_nansf("");
0328 }
0329 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {
0330 return __FLT_DENORM_MIN__;
0331 }
0332
0333 static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
0334 static _LIBCPP_CONSTEXPR const bool is_bounded = true;
0335 static _LIBCPP_CONSTEXPR const bool is_modulo = false;
0336
0337 static _LIBCPP_CONSTEXPR const bool traps = false;
0338 # if (defined(__arm__) || defined(__aarch64__))
0339 static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
0340 # else
0341 static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
0342 # endif
0343 static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
0344 };
0345
0346 template <>
0347 class __libcpp_numeric_limits<double, true> {
0348 protected:
0349 typedef double type;
0350
0351 static _LIBCPP_CONSTEXPR const bool is_specialized = true;
0352
0353 static _LIBCPP_CONSTEXPR const bool is_signed = true;
0354 static _LIBCPP_CONSTEXPR const int digits = __DBL_MANT_DIG__;
0355 static _LIBCPP_CONSTEXPR const int digits10 = __DBL_DIG__;
0356 static _LIBCPP_CONSTEXPR const int max_digits10 = 2 + (digits * 30103l) / 100000l;
0357 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __DBL_MIN__; }
0358 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __DBL_MAX__; }
0359 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); }
0360
0361 static _LIBCPP_CONSTEXPR const bool is_integer = false;
0362 static _LIBCPP_CONSTEXPR const bool is_exact = false;
0363 static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
0364 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __DBL_EPSILON__; }
0365 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5; }
0366
0367 static _LIBCPP_CONSTEXPR const int min_exponent = __DBL_MIN_EXP__;
0368 static _LIBCPP_CONSTEXPR const int min_exponent10 = __DBL_MIN_10_EXP__;
0369 static _LIBCPP_CONSTEXPR const int max_exponent = __DBL_MAX_EXP__;
0370 static _LIBCPP_CONSTEXPR const int max_exponent10 = __DBL_MAX_10_EXP__;
0371
0372 static _LIBCPP_CONSTEXPR const bool has_infinity = true;
0373 static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
0374 static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
0375 static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
0376 static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
0377 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {
0378 return __builtin_huge_val();
0379 }
0380 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {
0381 return __builtin_nan("");
0382 }
0383 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {
0384 return __builtin_nans("");
0385 }
0386 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {
0387 return __DBL_DENORM_MIN__;
0388 }
0389
0390 static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
0391 static _LIBCPP_CONSTEXPR const bool is_bounded = true;
0392 static _LIBCPP_CONSTEXPR const bool is_modulo = false;
0393
0394 static _LIBCPP_CONSTEXPR const bool traps = false;
0395 # if (defined(__arm__) || defined(__aarch64__))
0396 static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
0397 # else
0398 static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
0399 # endif
0400 static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
0401 };
0402
0403 template <>
0404 class __libcpp_numeric_limits<long double, true> {
0405 protected:
0406 typedef long double type;
0407
0408 static _LIBCPP_CONSTEXPR const bool is_specialized = true;
0409
0410 static _LIBCPP_CONSTEXPR const bool is_signed = true;
0411 static _LIBCPP_CONSTEXPR const int digits = __LDBL_MANT_DIG__;
0412 static _LIBCPP_CONSTEXPR const int digits10 = __LDBL_DIG__;
0413 static _LIBCPP_CONSTEXPR const int max_digits10 = 2 + (digits * 30103l) / 100000l;
0414 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __LDBL_MIN__; }
0415 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __LDBL_MAX__; }
0416 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); }
0417
0418 static _LIBCPP_CONSTEXPR const bool is_integer = false;
0419 static _LIBCPP_CONSTEXPR const bool is_exact = false;
0420 static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
0421 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __LDBL_EPSILON__; }
0422 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5L; }
0423
0424 static _LIBCPP_CONSTEXPR const int min_exponent = __LDBL_MIN_EXP__;
0425 static _LIBCPP_CONSTEXPR const int min_exponent10 = __LDBL_MIN_10_EXP__;
0426 static _LIBCPP_CONSTEXPR const int max_exponent = __LDBL_MAX_EXP__;
0427 static _LIBCPP_CONSTEXPR const int max_exponent10 = __LDBL_MAX_10_EXP__;
0428
0429 static _LIBCPP_CONSTEXPR const bool has_infinity = true;
0430 static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
0431 static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
0432 static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
0433 static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
0434 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {
0435 return __builtin_huge_vall();
0436 }
0437 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {
0438 return __builtin_nanl("");
0439 }
0440 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {
0441 return __builtin_nansl("");
0442 }
0443 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {
0444 return __LDBL_DENORM_MIN__;
0445 }
0446
0447 # if defined(__powerpc__) && defined(__LONG_DOUBLE_IBM128__)
0448 static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
0449 # else
0450 static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
0451 # endif
0452 static _LIBCPP_CONSTEXPR const bool is_bounded = true;
0453 static _LIBCPP_CONSTEXPR const bool is_modulo = false;
0454
0455 static _LIBCPP_CONSTEXPR const bool traps = false;
0456 # if (defined(__arm__) || defined(__aarch64__))
0457 static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
0458 # else
0459 static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
0460 # endif
0461 static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
0462 };
0463
0464 template <class _Tp>
0465 class _LIBCPP_TEMPLATE_VIS numeric_limits : private __libcpp_numeric_limits<_Tp> {
0466 typedef __libcpp_numeric_limits<_Tp> __base;
0467 typedef typename __base::type type;
0468
0469 public:
0470 static inline _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
0471 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); }
0472 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); }
0473 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); }
0474
0475 static inline _LIBCPP_CONSTEXPR const int digits = __base::digits;
0476 static inline _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
0477 static inline _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
0478 static inline _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
0479 static inline _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
0480 static inline _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
0481 static inline _LIBCPP_CONSTEXPR const int radix = __base::radix;
0482 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {
0483 return __base::epsilon();
0484 }
0485 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {
0486 return __base::round_error();
0487 }
0488
0489 static inline _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
0490 static inline _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
0491 static inline _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
0492 static inline _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
0493
0494 static inline _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
0495 static inline _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
0496 static inline _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
0497 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0498 static inline _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
0499 static inline _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
0500 _LIBCPP_SUPPRESS_DEPRECATED_POP
0501 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {
0502 return __base::infinity();
0503 }
0504 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {
0505 return __base::quiet_NaN();
0506 }
0507 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {
0508 return __base::signaling_NaN();
0509 }
0510 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {
0511 return __base::denorm_min();
0512 }
0513
0514 static inline _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
0515 static inline _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
0516 static inline _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
0517
0518 static inline _LIBCPP_CONSTEXPR const bool traps = __base::traps;
0519 static inline _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
0520 static inline _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
0521 };
0522
0523 template <class _Tp>
0524 class _LIBCPP_TEMPLATE_VIS numeric_limits<const _Tp> : public numeric_limits<_Tp> {};
0525
0526 template <class _Tp>
0527 class _LIBCPP_TEMPLATE_VIS numeric_limits<volatile _Tp> : public numeric_limits<_Tp> {};
0528
0529 template <class _Tp>
0530 class _LIBCPP_TEMPLATE_VIS numeric_limits<const volatile _Tp> : public numeric_limits<_Tp> {};
0531
0532 _LIBCPP_END_NAMESPACE_STD
0533
0534 _LIBCPP_POP_MACROS
0535
0536 # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0537 # include <type_traits>
0538 # endif
0539 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0540
0541 #endif // _LIBCPP_LIMITS