| 1 |
// -*- C++ -*- |
| 2 |
//===----------------------------------------------------------------------===// |
| 3 |
// |
| 4 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 |
// See https://llvm.org/LICENSE.txt for license information. |
| 6 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 |
// |
| 8 |
//===----------------------------------------------------------------------===// |
| 9 |
|
| 10 |
#ifndef _LIBCPP___CXX03_LIMITS |
| 11 |
#define _LIBCPP___CXX03_LIMITS |
| 12 |
|
| 13 |
/* |
| 14 |
limits synopsis |
| 15 |
|
| 16 |
namespace std |
| 17 |
{ |
| 18 |
|
| 19 |
template<class T> |
| 20 |
class numeric_limits |
| 21 |
{ |
| 22 |
public: |
| 23 |
static constexpr bool is_specialized = false; |
| 24 |
static constexpr T min() noexcept; |
| 25 |
static constexpr T max() noexcept; |
| 26 |
static constexpr T lowest() noexcept; |
| 27 |
|
| 28 |
static constexpr int digits = 0; |
| 29 |
static constexpr int digits10 = 0; |
| 30 |
static constexpr int max_digits10 = 0; |
| 31 |
static constexpr bool is_signed = false; |
| 32 |
static constexpr bool is_integer = false; |
| 33 |
static constexpr bool is_exact = false; |
| 34 |
static constexpr int radix = 0; |
| 35 |
static constexpr T epsilon() noexcept; |
| 36 |
static constexpr T round_error() noexcept; |
| 37 |
|
| 38 |
static constexpr int min_exponent = 0; |
| 39 |
static constexpr int min_exponent10 = 0; |
| 40 |
static constexpr int max_exponent = 0; |
| 41 |
static constexpr int max_exponent10 = 0; |
| 42 |
|
| 43 |
static constexpr bool has_infinity = false; |
| 44 |
static constexpr bool has_quiet_NaN = false; |
| 45 |
static constexpr bool has_signaling_NaN = false; |
| 46 |
static constexpr float_denorm_style has_denorm = denorm_absent; // deprecated in C++23 |
| 47 |
static constexpr bool has_denorm_loss = false; // deprecated in C++23 |
| 48 |
static constexpr T infinity() noexcept; |
| 49 |
static constexpr T quiet_NaN() noexcept; |
| 50 |
static constexpr T signaling_NaN() noexcept; |
| 51 |
static constexpr T denorm_min() noexcept; |
| 52 |
|
| 53 |
static constexpr bool is_iec559 = false; |
| 54 |
static constexpr bool is_bounded = false; |
| 55 |
static constexpr bool is_modulo = false; |
| 56 |
|
| 57 |
static constexpr bool traps = false; |
| 58 |
static constexpr bool tinyness_before = false; |
| 59 |
static constexpr float_round_style round_style = round_toward_zero; |
| 60 |
}; |
| 61 |
|
| 62 |
enum float_round_style |
| 63 |
{ |
| 64 |
round_indeterminate = -1, |
| 65 |
round_toward_zero = 0, |
| 66 |
round_to_nearest = 1, |
| 67 |
round_toward_infinity = 2, |
| 68 |
round_toward_neg_infinity = 3 |
| 69 |
}; |
| 70 |
|
| 71 |
enum float_denorm_style // deprecated in C++23 |
| 72 |
{ |
| 73 |
denorm_indeterminate = -1, |
| 74 |
denorm_absent = 0, |
| 75 |
denorm_present = 1 |
| 76 |
}; |
| 77 |
|
| 78 |
template<> class numeric_limits<cv bool>; |
| 79 |
|
| 80 |
template<> class numeric_limits<cv char>; |
| 81 |
template<> class numeric_limits<cv signed char>; |
| 82 |
template<> class numeric_limits<cv unsigned char>; |
| 83 |
template<> class numeric_limits<cv wchar_t>; |
| 84 |
template<> class numeric_limits<cv char8_t>; // C++20 |
| 85 |
template<> class numeric_limits<cv char16_t>; |
| 86 |
template<> class numeric_limits<cv char32_t>; |
| 87 |
|
| 88 |
template<> class numeric_limits<cv short>; |
| 89 |
template<> class numeric_limits<cv int>; |
| 90 |
template<> class numeric_limits<cv long>; |
| 91 |
template<> class numeric_limits<cv long long>; |
| 92 |
template<> class numeric_limits<cv unsigned short>; |
| 93 |
template<> class numeric_limits<cv unsigned int>; |
| 94 |
template<> class numeric_limits<cv unsigned long>; |
| 95 |
template<> class numeric_limits<cv unsigned long long>; |
| 96 |
|
| 97 |
template<> class numeric_limits<cv float>; |
| 98 |
template<> class numeric_limits<cv double>; |
| 99 |
template<> class numeric_limits<cv long double>; |
| 100 |
|
| 101 |
} // std |
| 102 |
|
| 103 |
*/ |
| 104 |
|
| 105 |
#include <__cxx03/__config> |
| 106 |
#include <__cxx03/__type_traits/is_arithmetic.h> |
| 107 |
#include <__cxx03/__type_traits/is_signed.h> |
| 108 |
#include <__cxx03/__type_traits/remove_cv.h> |
| 109 |
|
| 110 |
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 111 |
# pragma GCC system_header |
| 112 |
#endif |
| 113 |
|
| 114 |
_LIBCPP_PUSH_MACROS |
| 115 |
#include <__cxx03/__undef_macros> |
| 116 |
#include <__cxx03/version> |
| 117 |
|
| 118 |
_LIBCPP_BEGIN_NAMESPACE_STD |
| 119 |
|
| 120 |
enum float_round_style { |
| 121 |
round_indeterminate = -1, |
| 122 |
round_toward_zero = 0, |
| 123 |
round_to_nearest = 1, |
| 124 |
round_toward_infinity = 2, |
| 125 |
round_toward_neg_infinity = 3 |
| 126 |
}; |
| 127 |
|
| 128 |
enum float_denorm_style { denorm_indeterminate = -1, denorm_absent = 0, denorm_present = 1 }; |
| 129 |
|
| 130 |
template <class _Tp, bool = is_arithmetic<_Tp>::value> |
| 131 |
class __libcpp_numeric_limits { |
| 132 |
protected: |
| 133 |
typedef _Tp type; |
| 134 |
|
| 135 |
static const bool is_specialized = false; |
| 136 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type min() _NOEXCEPT { return type(); } |
| 137 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type max() _NOEXCEPT { return type(); } |
| 138 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type lowest() _NOEXCEPT { return type(); } |
| 139 |
|
| 140 |
static const int digits = 0; |
| 141 |
static const int digits10 = 0; |
| 142 |
static const int max_digits10 = 0; |
| 143 |
static const bool is_signed = false; |
| 144 |
static const bool is_integer = false; |
| 145 |
static const bool is_exact = false; |
| 146 |
static const int radix = 0; |
| 147 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type epsilon() _NOEXCEPT { return type(); } |
| 148 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type round_error() _NOEXCEPT { return type(); } |
| 149 |
|
| 150 |
static const int min_exponent = 0; |
| 151 |
static const int min_exponent10 = 0; |
| 152 |
static const int max_exponent = 0; |
| 153 |
static const int max_exponent10 = 0; |
| 154 |
|
| 155 |
static const bool has_infinity = false; |
| 156 |
static const bool has_quiet_NaN = false; |
| 157 |
static const bool has_signaling_NaN = false; |
| 158 |
static const float_denorm_style has_denorm = denorm_absent; |
| 159 |
static const bool has_denorm_loss = false; |
| 160 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type infinity() _NOEXCEPT { return type(); } |
| 161 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type quiet_NaN() _NOEXCEPT { return type(); } |
| 162 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type signaling_NaN() _NOEXCEPT { return type(); } |
| 163 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type denorm_min() _NOEXCEPT { return type(); } |
| 164 |
|
| 165 |
static const bool is_iec559 = false; |
| 166 |
static const bool is_bounded = false; |
| 167 |
static const bool is_modulo = false; |
| 168 |
|
| 169 |
static const bool traps = false; |
| 170 |
static const bool tinyness_before = false; |
| 171 |
static const float_round_style round_style = round_toward_zero; |
| 172 |
}; |
| 173 |
|
| 174 |
template <class _Tp, int __digits, bool _IsSigned> |
| 175 |
struct __libcpp_compute_min { |
| 176 |
static const _Tp value = _Tp(_Tp(1) << __digits); |
| 177 |
}; |
| 178 |
|
| 179 |
template <class _Tp, int __digits> |
| 180 |
struct __libcpp_compute_min<_Tp, __digits, false> { |
| 181 |
static const _Tp value = _Tp(0); |
| 182 |
}; |
| 183 |
|
| 184 |
template <class _Tp> |
| 185 |
class __libcpp_numeric_limits<_Tp, true> { |
| 186 |
protected: |
| 187 |
typedef _Tp type; |
| 188 |
|
| 189 |
static const bool is_specialized = true; |
| 190 |
|
| 191 |
static const bool is_signed = type(-1) < type(0); |
| 192 |
static const int digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed); |
| 193 |
static const int digits10 = digits * 3 / 10; |
| 194 |
static const int max_digits10 = 0; |
| 195 |
static const type __min = __libcpp_compute_min<type, digits, is_signed>::value; |
| 196 |
static const type __max = is_signed ? type(type(~0) ^ __min) : type(~0); |
| 197 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type min() _NOEXCEPT { return __min; } |
| 198 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type max() _NOEXCEPT { return __max; } |
| 199 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type lowest() _NOEXCEPT { return min(); } |
| 200 |
|
| 201 |
static const bool is_integer = true; |
| 202 |
static const bool is_exact = true; |
| 203 |
static const int radix = 2; |
| 204 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type epsilon() _NOEXCEPT { return type(0); } |
| 205 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type round_error() _NOEXCEPT { return type(0); } |
| 206 |
|
| 207 |
static const int min_exponent = 0; |
| 208 |
static const int min_exponent10 = 0; |
| 209 |
static const int max_exponent = 0; |
| 210 |
static const int max_exponent10 = 0; |
| 211 |
|
| 212 |
static const bool has_infinity = false; |
| 213 |
static const bool has_quiet_NaN = false; |
| 214 |
static const bool has_signaling_NaN = false; |
| 215 |
static const float_denorm_style has_denorm = denorm_absent; |
| 216 |
static const bool has_denorm_loss = false; |
| 217 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type infinity() _NOEXCEPT { return type(0); } |
| 218 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type quiet_NaN() _NOEXCEPT { return type(0); } |
| 219 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type signaling_NaN() _NOEXCEPT { return type(0); } |
| 220 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type denorm_min() _NOEXCEPT { return type(0); } |
| 221 |
|
| 222 |
static const bool is_iec559 = false; |
| 223 |
static const bool is_bounded = true; |
| 224 |
static const bool is_modulo = !std::is_signed<_Tp>::value; |
| 225 |
|
| 226 |
#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || defined(__wasm__) |
| 227 |
static const bool traps = true; |
| 228 |
#else |
| 229 |
static const bool traps = false; |
| 230 |
#endif |
| 231 |
static const bool tinyness_before = false; |
| 232 |
static const float_round_style round_style = round_toward_zero; |
| 233 |
}; |
| 234 |
|
| 235 |
template <> |
| 236 |
class __libcpp_numeric_limits<bool, true> { |
| 237 |
protected: |
| 238 |
typedef bool type; |
| 239 |
|
| 240 |
static const bool is_specialized = true; |
| 241 |
|
| 242 |
static const bool is_signed = false; |
| 243 |
static const int digits = 1; |
| 244 |
static const int digits10 = 0; |
| 245 |
static const int max_digits10 = 0; |
| 246 |
static const type __min = false; |
| 247 |
static const type __max = true; |
| 248 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type min() _NOEXCEPT { return __min; } |
| 249 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type max() _NOEXCEPT { return __max; } |
| 250 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type lowest() _NOEXCEPT { return min(); } |
| 251 |
|
| 252 |
static const bool is_integer = true; |
| 253 |
static const bool is_exact = true; |
| 254 |
static const int radix = 2; |
| 255 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type epsilon() _NOEXCEPT { return type(0); } |
| 256 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type round_error() _NOEXCEPT { return type(0); } |
| 257 |
|
| 258 |
static const int min_exponent = 0; |
| 259 |
static const int min_exponent10 = 0; |
| 260 |
static const int max_exponent = 0; |
| 261 |
static const int max_exponent10 = 0; |
| 262 |
|
| 263 |
static const bool has_infinity = false; |
| 264 |
static const bool has_quiet_NaN = false; |
| 265 |
static const bool has_signaling_NaN = false; |
| 266 |
static const float_denorm_style has_denorm = denorm_absent; |
| 267 |
static const bool has_denorm_loss = false; |
| 268 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type infinity() _NOEXCEPT { return type(0); } |
| 269 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type quiet_NaN() _NOEXCEPT { return type(0); } |
| 270 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type signaling_NaN() _NOEXCEPT { return type(0); } |
| 271 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type denorm_min() _NOEXCEPT { return type(0); } |
| 272 |
|
| 273 |
static const bool is_iec559 = false; |
| 274 |
static const bool is_bounded = true; |
| 275 |
static const bool is_modulo = false; |
| 276 |
|
| 277 |
static const bool traps = false; |
| 278 |
static const bool tinyness_before = false; |
| 279 |
static const float_round_style round_style = round_toward_zero; |
| 280 |
}; |
| 281 |
|
| 282 |
template <> |
| 283 |
class __libcpp_numeric_limits<float, true> { |
| 284 |
protected: |
| 285 |
typedef float type; |
| 286 |
|
| 287 |
static const bool is_specialized = true; |
| 288 |
|
| 289 |
static const bool is_signed = true; |
| 290 |
static const int digits = __FLT_MANT_DIG__; |
| 291 |
static const int digits10 = __FLT_DIG__; |
| 292 |
static const int max_digits10 = 2 + (digits * 30103l) / 100000l; |
| 293 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type min() _NOEXCEPT { return __FLT_MIN__; } |
| 294 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type max() _NOEXCEPT { return __FLT_MAX__; } |
| 295 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type lowest() _NOEXCEPT { return -max(); } |
| 296 |
|
| 297 |
static const bool is_integer = false; |
| 298 |
static const bool is_exact = false; |
| 299 |
static const int radix = __FLT_RADIX__; |
| 300 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type epsilon() _NOEXCEPT { return __FLT_EPSILON__; } |
| 301 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type round_error() _NOEXCEPT { return 0.5F; } |
| 302 |
|
| 303 |
static const int min_exponent = __FLT_MIN_EXP__; |
| 304 |
static const int min_exponent10 = __FLT_MIN_10_EXP__; |
| 305 |
static const int max_exponent = __FLT_MAX_EXP__; |
| 306 |
static const int max_exponent10 = __FLT_MAX_10_EXP__; |
| 307 |
|
| 308 |
static const bool has_infinity = true; |
| 309 |
static const bool has_quiet_NaN = true; |
| 310 |
static const bool has_signaling_NaN = true; |
| 311 |
static const float_denorm_style has_denorm = denorm_present; |
| 312 |
static const bool has_denorm_loss = false; |
| 313 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type infinity() _NOEXCEPT { return __builtin_huge_valf(); } |
| 314 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type quiet_NaN() _NOEXCEPT { return __builtin_nanf(""); } |
| 315 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type signaling_NaN() _NOEXCEPT { return __builtin_nansf(""); } |
| 316 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type denorm_min() _NOEXCEPT { return __FLT_DENORM_MIN__; } |
| 317 |
|
| 318 |
static const bool is_iec559 = true; |
| 319 |
static const bool is_bounded = true; |
| 320 |
static const bool is_modulo = false; |
| 321 |
|
| 322 |
static const bool traps = false; |
| 323 |
#if (defined(__arm__) || defined(__aarch64__)) |
| 324 |
static const bool tinyness_before = true; |
| 325 |
#else |
| 326 |
static const bool tinyness_before = false; |
| 327 |
#endif |
| 328 |
static const float_round_style round_style = round_to_nearest; |
| 329 |
}; |
| 330 |
|
| 331 |
template <> |
| 332 |
class __libcpp_numeric_limits<double, true> { |
| 333 |
protected: |
| 334 |
typedef double type; |
| 335 |
|
| 336 |
static const bool is_specialized = true; |
| 337 |
|
| 338 |
static const bool is_signed = true; |
| 339 |
static const int digits = __DBL_MANT_DIG__; |
| 340 |
static const int digits10 = __DBL_DIG__; |
| 341 |
static const int max_digits10 = 2 + (digits * 30103l) / 100000l; |
| 342 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type min() _NOEXCEPT { return __DBL_MIN__; } |
| 343 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type max() _NOEXCEPT { return __DBL_MAX__; } |
| 344 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type lowest() _NOEXCEPT { return -max(); } |
| 345 |
|
| 346 |
static const bool is_integer = false; |
| 347 |
static const bool is_exact = false; |
| 348 |
static const int radix = __FLT_RADIX__; |
| 349 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type epsilon() _NOEXCEPT { return __DBL_EPSILON__; } |
| 350 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type round_error() _NOEXCEPT { return 0.5; } |
| 351 |
|
| 352 |
static const int min_exponent = __DBL_MIN_EXP__; |
| 353 |
static const int min_exponent10 = __DBL_MIN_10_EXP__; |
| 354 |
static const int max_exponent = __DBL_MAX_EXP__; |
| 355 |
static const int max_exponent10 = __DBL_MAX_10_EXP__; |
| 356 |
|
| 357 |
static const bool has_infinity = true; |
| 358 |
static const bool has_quiet_NaN = true; |
| 359 |
static const bool has_signaling_NaN = true; |
| 360 |
static const float_denorm_style has_denorm = denorm_present; |
| 361 |
static const bool has_denorm_loss = false; |
| 362 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type infinity() _NOEXCEPT { return __builtin_huge_val(); } |
| 363 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type quiet_NaN() _NOEXCEPT { return __builtin_nan(""); } |
| 364 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type signaling_NaN() _NOEXCEPT { return __builtin_nans(""); } |
| 365 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type denorm_min() _NOEXCEPT { return __DBL_DENORM_MIN__; } |
| 366 |
|
| 367 |
static const bool is_iec559 = true; |
| 368 |
static const bool is_bounded = true; |
| 369 |
static const bool is_modulo = false; |
| 370 |
|
| 371 |
static const bool traps = false; |
| 372 |
#if (defined(__arm__) || defined(__aarch64__)) |
| 373 |
static const bool tinyness_before = true; |
| 374 |
#else |
| 375 |
static const bool tinyness_before = false; |
| 376 |
#endif |
| 377 |
static const float_round_style round_style = round_to_nearest; |
| 378 |
}; |
| 379 |
|
| 380 |
template <> |
| 381 |
class __libcpp_numeric_limits<long double, true> { |
| 382 |
protected: |
| 383 |
typedef long double type; |
| 384 |
|
| 385 |
static const bool is_specialized = true; |
| 386 |
|
| 387 |
static const bool is_signed = true; |
| 388 |
static const int digits = __LDBL_MANT_DIG__; |
| 389 |
static const int digits10 = __LDBL_DIG__; |
| 390 |
static const int max_digits10 = 2 + (digits * 30103l) / 100000l; |
| 391 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type min() _NOEXCEPT { return __LDBL_MIN__; } |
| 392 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type max() _NOEXCEPT { return __LDBL_MAX__; } |
| 393 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type lowest() _NOEXCEPT { return -max(); } |
| 394 |
|
| 395 |
static const bool is_integer = false; |
| 396 |
static const bool is_exact = false; |
| 397 |
static const int radix = __FLT_RADIX__; |
| 398 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type epsilon() _NOEXCEPT { return __LDBL_EPSILON__; } |
| 399 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type round_error() _NOEXCEPT { return 0.5L; } |
| 400 |
|
| 401 |
static const int min_exponent = __LDBL_MIN_EXP__; |
| 402 |
static const int min_exponent10 = __LDBL_MIN_10_EXP__; |
| 403 |
static const int max_exponent = __LDBL_MAX_EXP__; |
| 404 |
static const int max_exponent10 = __LDBL_MAX_10_EXP__; |
| 405 |
|
| 406 |
static const bool has_infinity = true; |
| 407 |
static const bool has_quiet_NaN = true; |
| 408 |
static const bool has_signaling_NaN = true; |
| 409 |
static const float_denorm_style has_denorm = denorm_present; |
| 410 |
static const bool has_denorm_loss = false; |
| 411 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type infinity() _NOEXCEPT { return __builtin_huge_vall(); } |
| 412 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type quiet_NaN() _NOEXCEPT { return __builtin_nanl(""); } |
| 413 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type signaling_NaN() _NOEXCEPT { return __builtin_nansl(""); } |
| 414 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type denorm_min() _NOEXCEPT { return __LDBL_DENORM_MIN__; } |
| 415 |
|
| 416 |
#if defined(__powerpc__) && defined(__LONG_DOUBLE_IBM128__) |
| 417 |
static const bool is_iec559 = false; |
| 418 |
#else |
| 419 |
static const bool is_iec559 = true; |
| 420 |
#endif |
| 421 |
static const bool is_bounded = true; |
| 422 |
static const bool is_modulo = false; |
| 423 |
|
| 424 |
static const bool traps = false; |
| 425 |
#if (defined(__arm__) || defined(__aarch64__)) |
| 426 |
static const bool tinyness_before = true; |
| 427 |
#else |
| 428 |
static const bool tinyness_before = false; |
| 429 |
#endif |
| 430 |
static const float_round_style round_style = round_to_nearest; |
| 431 |
}; |
| 432 |
|
| 433 |
template <class _Tp> |
| 434 |
class _LIBCPP_TEMPLATE_VIS numeric_limits : private __libcpp_numeric_limits<_Tp> { |
| 435 |
typedef __libcpp_numeric_limits<_Tp> __base; |
| 436 |
typedef typename __base::type type; |
| 437 |
|
| 438 |
public: |
| 439 |
static const bool is_specialized = __base::is_specialized; |
| 440 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type min() _NOEXCEPT { return __base::min(); } |
| 441 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type max() _NOEXCEPT { return __base::max(); } |
| 442 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type lowest() _NOEXCEPT { return __base::lowest(); } |
| 443 |
|
| 444 |
static const int digits = __base::digits; |
| 445 |
static const int digits10 = __base::digits10; |
| 446 |
static const int max_digits10 = __base::max_digits10; |
| 447 |
static const bool is_signed = __base::is_signed; |
| 448 |
static const bool is_integer = __base::is_integer; |
| 449 |
static const bool is_exact = __base::is_exact; |
| 450 |
static const int radix = __base::radix; |
| 451 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type epsilon() _NOEXCEPT { return __base::epsilon(); } |
| 452 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type round_error() _NOEXCEPT { return __base::round_error(); } |
| 453 |
|
| 454 |
static const int min_exponent = __base::min_exponent; |
| 455 |
static const int min_exponent10 = __base::min_exponent10; |
| 456 |
static const int max_exponent = __base::max_exponent; |
| 457 |
static const int max_exponent10 = __base::max_exponent10; |
| 458 |
|
| 459 |
static const bool has_infinity = __base::has_infinity; |
| 460 |
static const bool has_quiet_NaN = __base::has_quiet_NaN; |
| 461 |
static const bool has_signaling_NaN = __base::has_signaling_NaN; |
| 462 |
_LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 463 |
static const float_denorm_style has_denorm = __base::has_denorm; |
| 464 |
static const bool has_denorm_loss = __base::has_denorm_loss; |
| 465 |
_LIBCPP_SUPPRESS_DEPRECATED_POP |
| 466 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type infinity() _NOEXCEPT { return __base::infinity(); } |
| 467 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); } |
| 468 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); } |
| 469 |
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static type denorm_min() _NOEXCEPT { return __base::denorm_min(); } |
| 470 |
|
| 471 |
static const bool is_iec559 = __base::is_iec559; |
| 472 |
static const bool is_bounded = __base::is_bounded; |
| 473 |
static const bool is_modulo = __base::is_modulo; |
| 474 |
|
| 475 |
static const bool traps = __base::traps; |
| 476 |
static const bool tinyness_before = __base::tinyness_before; |
| 477 |
static const float_round_style round_style = __base::round_style; |
| 478 |
}; |
| 479 |
|
| 480 |
template <class _Tp> |
| 481 |
const bool numeric_limits<_Tp>::is_specialized; |
| 482 |
template <class _Tp> |
| 483 |
const int numeric_limits<_Tp>::digits; |
| 484 |
template <class _Tp> |
| 485 |
const int numeric_limits<_Tp>::digits10; |
| 486 |
template <class _Tp> |
| 487 |
const int numeric_limits<_Tp>::max_digits10; |
| 488 |
template <class _Tp> |
| 489 |
const bool numeric_limits<_Tp>::is_signed; |
| 490 |
template <class _Tp> |
| 491 |
const bool numeric_limits<_Tp>::is_integer; |
| 492 |
template <class _Tp> |
| 493 |
const bool numeric_limits<_Tp>::is_exact; |
| 494 |
template <class _Tp> |
| 495 |
const int numeric_limits<_Tp>::radix; |
| 496 |
template <class _Tp> |
| 497 |
const int numeric_limits<_Tp>::min_exponent; |
| 498 |
template <class _Tp> |
| 499 |
const int numeric_limits<_Tp>::min_exponent10; |
| 500 |
template <class _Tp> |
| 501 |
const int numeric_limits<_Tp>::max_exponent; |
| 502 |
template <class _Tp> |
| 503 |
const int numeric_limits<_Tp>::max_exponent10; |
| 504 |
template <class _Tp> |
| 505 |
const bool numeric_limits<_Tp>::has_infinity; |
| 506 |
template <class _Tp> |
| 507 |
const bool numeric_limits<_Tp>::has_quiet_NaN; |
| 508 |
template <class _Tp> |
| 509 |
const bool numeric_limits<_Tp>::has_signaling_NaN; |
| 510 |
template <class _Tp> |
| 511 |
const float_denorm_style numeric_limits<_Tp>::has_denorm; |
| 512 |
template <class _Tp> |
| 513 |
const bool numeric_limits<_Tp>::has_denorm_loss; |
| 514 |
template <class _Tp> |
| 515 |
const bool numeric_limits<_Tp>::is_iec559; |
| 516 |
template <class _Tp> |
| 517 |
const bool numeric_limits<_Tp>::is_bounded; |
| 518 |
template <class _Tp> |
| 519 |
const bool numeric_limits<_Tp>::is_modulo; |
| 520 |
template <class _Tp> |
| 521 |
const bool numeric_limits<_Tp>::traps; |
| 522 |
template <class _Tp> |
| 523 |
const bool numeric_limits<_Tp>::tinyness_before; |
| 524 |
template <class _Tp> |
| 525 |
const float_round_style numeric_limits<_Tp>::round_style; |
| 526 |
|
| 527 |
template <class _Tp> |
| 528 |
class _LIBCPP_TEMPLATE_VIS numeric_limits<const _Tp> : public numeric_limits<_Tp> {}; |
| 529 |
|
| 530 |
template <class _Tp> |
| 531 |
class _LIBCPP_TEMPLATE_VIS numeric_limits<volatile _Tp> : public numeric_limits<_Tp> {}; |
| 532 |
|
| 533 |
template <class _Tp> |
| 534 |
class _LIBCPP_TEMPLATE_VIS numeric_limits<const volatile _Tp> : public numeric_limits<_Tp> {}; |
| 535 |
|
| 536 |
_LIBCPP_END_NAMESPACE_STD |
| 537 |
|
| 538 |
_LIBCPP_POP_MACROS |
| 539 |
|
| 540 |
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) |
| 541 |
# include <__cxx03/type_traits> |
| 542 |
#endif |
| 543 |
|
| 544 |
#endif // _LIBCPP___CXX03_LIMITS |