| 1 | /*
|
|---|
| 2 | * SPDX-FileCopyrightText: 2018 Jaroslav Jindrak
|
|---|
| 3 | *
|
|---|
| 4 | * SPDX-License-Identifier: BSD-3-Clause
|
|---|
| 5 | */
|
|---|
| 6 |
|
|---|
| 7 | #ifndef LIBCPP_BITS_LIMITS
|
|---|
| 8 | #define LIBCPP_BITS_LIMITS
|
|---|
| 9 |
|
|---|
| 10 | #include <cstdint>
|
|---|
| 11 | #include <climits>
|
|---|
| 12 |
|
|---|
| 13 | namespace std
|
|---|
| 14 | {
|
|---|
| 15 |
|
|---|
| 16 | /**
|
|---|
| 17 | * 18.3.2.5, type float_round_style:
|
|---|
| 18 | */
|
|---|
| 19 |
|
|---|
| 20 | enum float_round_style
|
|---|
| 21 | {
|
|---|
| 22 | round_indeterminate = -1,
|
|---|
| 23 | round_toward_zero = 0,
|
|---|
| 24 | round_to_nearest = 1,
|
|---|
| 25 | round_toward_infinity = 2,
|
|---|
| 26 | round_toward_neg_infinity = 3
|
|---|
| 27 | };
|
|---|
| 28 |
|
|---|
| 29 | /**
|
|---|
| 30 | * 18.3.2.6, type float_denorm_style:
|
|---|
| 31 | */
|
|---|
| 32 |
|
|---|
| 33 | enum float_denorm_style
|
|---|
| 34 | {
|
|---|
| 35 | denorm_indeterminate = -1,
|
|---|
| 36 | denorm_absent = 0,
|
|---|
| 37 | denorm_present = 1
|
|---|
| 38 | };
|
|---|
| 39 |
|
|---|
| 40 | /**
|
|---|
| 41 | * 18.3.2.3, class template numeric_limits:
|
|---|
| 42 | */
|
|---|
| 43 |
|
|---|
| 44 | namespace aux
|
|---|
| 45 | {
|
|---|
| 46 | template<class T>
|
|---|
| 47 | class numeric_limits
|
|---|
| 48 | {
|
|---|
| 49 | public:
|
|---|
| 50 | static constexpr bool is_specialized = false;
|
|---|
| 51 |
|
|---|
| 52 | static constexpr T min() noexcept
|
|---|
| 53 | {
|
|---|
| 54 | return T{};
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | static constexpr T max() noexcept
|
|---|
| 58 | {
|
|---|
| 59 | return T{};
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | static constexpr T lowest() noexcept
|
|---|
| 63 | {
|
|---|
| 64 | return T{};
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | static constexpr int digits = 0;
|
|---|
| 68 | static constexpr int digits10 = 0;
|
|---|
| 69 | static constexpr int max_digits10 = 0;
|
|---|
| 70 |
|
|---|
| 71 | static constexpr bool is_signed = false;
|
|---|
| 72 | static constexpr bool is_integer = false;
|
|---|
| 73 | static constexpr bool is_exact = false;
|
|---|
| 74 |
|
|---|
| 75 | static constexpr int radix = 0;
|
|---|
| 76 |
|
|---|
| 77 | static constexpr T epsilon() noexcept
|
|---|
| 78 | {
|
|---|
| 79 | return T{};
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 | static constexpr T round_error() noexcept
|
|---|
| 83 | {
|
|---|
| 84 | return T{};
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | static constexpr int min_exponent = 0;
|
|---|
| 88 | static constexpr int min_exponent10 = 0;
|
|---|
| 89 | static constexpr int max_exponent = 0;
|
|---|
| 90 | static constexpr int max_exponent10 = 0;
|
|---|
| 91 |
|
|---|
| 92 | static constexpr bool has_infinity = false;
|
|---|
| 93 | static constexpr bool has_quiet_NaN = false;
|
|---|
| 94 | static constexpr bool has_signaling_NaN = false;
|
|---|
| 95 |
|
|---|
| 96 | static constexpr float_denorm_style has_denorm = denorm_absent;
|
|---|
| 97 | static constexpr bool has_denorm_loss = false;
|
|---|
| 98 |
|
|---|
| 99 | static constexpr T infinity() noexcept
|
|---|
| 100 | {
|
|---|
| 101 | return T{};
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | static constexpr T quiet_NaN() noexcept
|
|---|
| 105 | {
|
|---|
| 106 | return T{};
|
|---|
| 107 | }
|
|---|
| 108 |
|
|---|
| 109 | static constexpr T signaling_NaN() noexcept
|
|---|
| 110 | {
|
|---|
| 111 | return T{};
|
|---|
| 112 | }
|
|---|
| 113 |
|
|---|
| 114 | static constexpr T denorm_min() noexcept
|
|---|
| 115 | {
|
|---|
| 116 | return T{};
|
|---|
| 117 | }
|
|---|
| 118 |
|
|---|
| 119 | static constexpr bool is_iec559 = false;
|
|---|
| 120 | static constexpr bool is_bounded = false;
|
|---|
| 121 | static constexpr bool is_modulo = false;
|
|---|
| 122 |
|
|---|
| 123 | static constexpr bool traps = false;
|
|---|
| 124 | static constexpr bool tinyness_before = false;
|
|---|
| 125 |
|
|---|
| 126 | static constexpr float_round_style round_style = round_toward_zero;
|
|---|
| 127 | };
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| 130 | template<class T>
|
|---|
| 131 | class numeric_limits: public aux::numeric_limits<T>
|
|---|
| 132 | { /* DUMMY BODY */ };
|
|---|
| 133 |
|
|---|
| 134 | template<class T>
|
|---|
| 135 | class numeric_limits<const T>: public numeric_limits<T>
|
|---|
| 136 | { /* DUMMY BODY */ };
|
|---|
| 137 |
|
|---|
| 138 | template<class T>
|
|---|
| 139 | class numeric_limits<volatile T>: public numeric_limits<T>
|
|---|
| 140 | { /* DUMMY BODY */ };
|
|---|
| 141 |
|
|---|
| 142 | template<class T>
|
|---|
| 143 | class numeric_limits<const volatile T>: public numeric_limits<T>
|
|---|
| 144 | { /* DUMMY BODY */ };
|
|---|
| 145 |
|
|---|
| 146 | /**
|
|---|
| 147 | * 18.3.2.3, class template numeric_limits:
|
|---|
| 148 | */
|
|---|
| 149 |
|
|---|
| 150 | template<>
|
|---|
| 151 | class numeric_limits<float>
|
|---|
| 152 | {
|
|---|
| 153 | public:
|
|---|
| 154 | static constexpr bool is_specialized = true;
|
|---|
| 155 |
|
|---|
| 156 | static constexpr float min() noexcept
|
|---|
| 157 | {
|
|---|
| 158 | return 1.17549435e-38f;
|
|---|
| 159 | }
|
|---|
| 160 |
|
|---|
| 161 | static constexpr float max() noexcept
|
|---|
| 162 | {
|
|---|
| 163 | return 3.40282347e+38f;
|
|---|
| 164 | }
|
|---|
| 165 |
|
|---|
| 166 | static constexpr float lowest() noexcept
|
|---|
| 167 | {
|
|---|
| 168 | return -3.40282347e+38f;
|
|---|
| 169 | }
|
|---|
| 170 |
|
|---|
| 171 | static constexpr int digits = 24;
|
|---|
| 172 | static constexpr int digits10 = 6;
|
|---|
| 173 | static constexpr int max_digits10 = 9;
|
|---|
| 174 |
|
|---|
| 175 | static constexpr bool is_signed = true;
|
|---|
| 176 | static constexpr bool is_integer = false;
|
|---|
| 177 | static constexpr bool is_exact = false;
|
|---|
| 178 |
|
|---|
| 179 | static constexpr int radix = 2;
|
|---|
| 180 |
|
|---|
| 181 | static constexpr float epsilon() noexcept
|
|---|
| 182 | {
|
|---|
| 183 | return 1.19209290e-07f;
|
|---|
| 184 | }
|
|---|
| 185 |
|
|---|
| 186 | static constexpr float round_error() noexcept
|
|---|
| 187 | {
|
|---|
| 188 | return 0.5f;
|
|---|
| 189 | }
|
|---|
| 190 |
|
|---|
| 191 | static constexpr int min_exponent = -127;
|
|---|
| 192 | static constexpr int min_exponent10 = -37;
|
|---|
| 193 | static constexpr int max_exponent = 128;
|
|---|
| 194 | static constexpr int max_exponent10 = 38;
|
|---|
| 195 |
|
|---|
| 196 | static constexpr bool has_infinity = true;
|
|---|
| 197 | static constexpr bool has_quiet_NaN = true;
|
|---|
| 198 | static constexpr bool has_signaling_NaN = true;
|
|---|
| 199 |
|
|---|
| 200 | static constexpr float_denorm_style has_denorm = denorm_absent;
|
|---|
| 201 | static constexpr bool has_denorm_loss = false;
|
|---|
| 202 |
|
|---|
| 203 | static constexpr float infinity() noexcept
|
|---|
| 204 | {
|
|---|
| 205 | // TODO: implement
|
|---|
| 206 | return 0.f;
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| 209 | static constexpr float quiet_NaN() noexcept
|
|---|
| 210 | {
|
|---|
| 211 | // TODO: implement
|
|---|
| 212 | return 0.f;
|
|---|
| 213 | }
|
|---|
| 214 |
|
|---|
| 215 | static constexpr float signaling_NaN() noexcept
|
|---|
| 216 | {
|
|---|
| 217 | // TODO: implement
|
|---|
| 218 | return 0.f;
|
|---|
| 219 | }
|
|---|
| 220 |
|
|---|
| 221 | static constexpr float denorm_min() noexcept
|
|---|
| 222 | {
|
|---|
| 223 | return min();
|
|---|
| 224 | }
|
|---|
| 225 |
|
|---|
| 226 | static constexpr bool is_iec559 = true;
|
|---|
| 227 | static constexpr bool is_bounded = true;
|
|---|
| 228 | static constexpr bool is_modulo = false;
|
|---|
| 229 |
|
|---|
| 230 | static constexpr bool traps = true;
|
|---|
| 231 | static constexpr bool tinyness_before = true;
|
|---|
| 232 |
|
|---|
| 233 | static constexpr float_round_style round_style = round_to_nearest;
|
|---|
| 234 | };
|
|---|
| 235 |
|
|---|
| 236 | template<>
|
|---|
| 237 | class numeric_limits<bool>
|
|---|
| 238 | {
|
|---|
| 239 | public:
|
|---|
| 240 | static constexpr bool is_specialized = true;
|
|---|
| 241 |
|
|---|
| 242 | static constexpr bool min() noexcept
|
|---|
| 243 | {
|
|---|
| 244 | return false;
|
|---|
| 245 | }
|
|---|
| 246 |
|
|---|
| 247 | static constexpr bool max() noexcept
|
|---|
| 248 | {
|
|---|
| 249 | return true;
|
|---|
| 250 | }
|
|---|
| 251 |
|
|---|
| 252 | static constexpr bool lowest() noexcept
|
|---|
| 253 | {
|
|---|
| 254 | return false;
|
|---|
| 255 | }
|
|---|
| 256 |
|
|---|
| 257 | static constexpr int digits = 1;
|
|---|
| 258 | static constexpr int digits10 = 0;
|
|---|
| 259 | static constexpr int max_digits10 = 0;
|
|---|
| 260 |
|
|---|
| 261 | static constexpr bool is_signed = false;
|
|---|
| 262 | static constexpr bool is_integer = true;
|
|---|
| 263 | static constexpr bool is_exact = true;
|
|---|
| 264 |
|
|---|
| 265 | static constexpr int radix = 2;
|
|---|
| 266 |
|
|---|
| 267 | static constexpr bool epsilon() noexcept
|
|---|
| 268 | {
|
|---|
| 269 | return 0;
|
|---|
| 270 | }
|
|---|
| 271 |
|
|---|
| 272 | static constexpr bool round_error() noexcept
|
|---|
| 273 | {
|
|---|
| 274 | return 0;
|
|---|
| 275 | }
|
|---|
| 276 |
|
|---|
| 277 | static constexpr int min_exponent = 0;
|
|---|
| 278 | static constexpr int min_exponent10 = 0;
|
|---|
| 279 | static constexpr int max_exponent = 0;
|
|---|
| 280 | static constexpr int max_exponent10 = 0;
|
|---|
| 281 |
|
|---|
| 282 | static constexpr bool has_infinity = false;
|
|---|
| 283 | static constexpr bool has_quiet_NaN = false;
|
|---|
| 284 | static constexpr bool has_signaling_NaN = false;
|
|---|
| 285 |
|
|---|
| 286 | static constexpr float_denorm_style has_denorm = denorm_absent;
|
|---|
| 287 | static constexpr bool has_denorm_loss = false;
|
|---|
| 288 |
|
|---|
| 289 | static constexpr bool infinity() noexcept
|
|---|
| 290 | {
|
|---|
| 291 | return 0;
|
|---|
| 292 | }
|
|---|
| 293 |
|
|---|
| 294 | static constexpr bool quiet_NaN() noexcept
|
|---|
| 295 | {
|
|---|
| 296 | return 0;
|
|---|
| 297 | }
|
|---|
| 298 |
|
|---|
| 299 | static constexpr bool signaling_NaN() noexcept
|
|---|
| 300 | {
|
|---|
| 301 | return 0;
|
|---|
| 302 | }
|
|---|
| 303 |
|
|---|
| 304 | static constexpr bool denorm_min() noexcept
|
|---|
| 305 | {
|
|---|
| 306 | return 0;
|
|---|
| 307 | }
|
|---|
| 308 |
|
|---|
| 309 | static constexpr bool is_iec559 = false;
|
|---|
| 310 | static constexpr bool is_bounded = true;
|
|---|
| 311 | static constexpr bool is_modulo = false;
|
|---|
| 312 |
|
|---|
| 313 | static constexpr bool traps = false;
|
|---|
| 314 | static constexpr bool tinyness_before = false;
|
|---|
| 315 |
|
|---|
| 316 | static constexpr float_round_style round_style = round_toward_zero;
|
|---|
| 317 | };
|
|---|
| 318 |
|
|---|
| 319 | /**
|
|---|
| 320 | * Note: Because of the limited state of limit.h, we define only
|
|---|
| 321 | * the most basic properties of the most basic types (that are likely
|
|---|
| 322 | * to be used in a program that is being ported to HelenOS).
|
|---|
| 323 | */
|
|---|
| 324 |
|
|---|
| 325 | template<>
|
|---|
| 326 | class numeric_limits<char>: public aux::numeric_limits<char>
|
|---|
| 327 | {
|
|---|
| 328 | public:
|
|---|
| 329 | static constexpr bool is_specialized = true;
|
|---|
| 330 |
|
|---|
| 331 | static constexpr int digits = sizeof(char) * 8;
|
|---|
| 332 |
|
|---|
| 333 | static constexpr char max()
|
|---|
| 334 | {
|
|---|
| 335 | return CHAR_MAX;
|
|---|
| 336 | }
|
|---|
| 337 |
|
|---|
| 338 | static constexpr char min()
|
|---|
| 339 | {
|
|---|
| 340 | return CHAR_MIN;
|
|---|
| 341 | }
|
|---|
| 342 |
|
|---|
| 343 | static constexpr char lowest()
|
|---|
| 344 | {
|
|---|
| 345 | return min();
|
|---|
| 346 | }
|
|---|
| 347 | };
|
|---|
| 348 |
|
|---|
| 349 | template<>
|
|---|
| 350 | class numeric_limits<signed char>: public aux::numeric_limits<signed char>
|
|---|
| 351 | {
|
|---|
| 352 | public:
|
|---|
| 353 | static constexpr bool is_specialized = true;
|
|---|
| 354 |
|
|---|
| 355 | static constexpr int digits = sizeof(signed char) * 8 - 1;
|
|---|
| 356 |
|
|---|
| 357 | static constexpr signed char max()
|
|---|
| 358 | {
|
|---|
| 359 | return SCHAR_MAX;
|
|---|
| 360 | }
|
|---|
| 361 |
|
|---|
| 362 | static constexpr signed char min()
|
|---|
| 363 | {
|
|---|
| 364 | return SCHAR_MIN;
|
|---|
| 365 | }
|
|---|
| 366 |
|
|---|
| 367 | static constexpr signed char lowest()
|
|---|
| 368 | {
|
|---|
| 369 | return min();
|
|---|
| 370 | }
|
|---|
| 371 | };
|
|---|
| 372 |
|
|---|
| 373 | template<>
|
|---|
| 374 | class numeric_limits<short>: public aux::numeric_limits<short>
|
|---|
| 375 | {
|
|---|
| 376 | public:
|
|---|
| 377 | static constexpr bool is_specialized = true;
|
|---|
| 378 |
|
|---|
| 379 | static constexpr int digits = sizeof(short) * 8 - 1;
|
|---|
| 380 |
|
|---|
| 381 | static constexpr short max()
|
|---|
| 382 | {
|
|---|
| 383 | return SHRT_MAX;
|
|---|
| 384 | }
|
|---|
| 385 |
|
|---|
| 386 | static constexpr short min()
|
|---|
| 387 | {
|
|---|
| 388 | return SHRT_MIN;
|
|---|
| 389 | }
|
|---|
| 390 |
|
|---|
| 391 | static constexpr short lowest()
|
|---|
| 392 | {
|
|---|
| 393 | return min();
|
|---|
| 394 | }
|
|---|
| 395 | };
|
|---|
| 396 |
|
|---|
| 397 | template<>
|
|---|
| 398 | class numeric_limits<int>: public aux::numeric_limits<int>
|
|---|
| 399 | {
|
|---|
| 400 | public:
|
|---|
| 401 | static constexpr bool is_specialized = true;
|
|---|
| 402 |
|
|---|
| 403 | static constexpr int digits = sizeof(int) * 8 - 1;
|
|---|
| 404 |
|
|---|
| 405 | static constexpr int max()
|
|---|
| 406 | {
|
|---|
| 407 | return INT_MAX;
|
|---|
| 408 | }
|
|---|
| 409 |
|
|---|
| 410 | static constexpr int min()
|
|---|
| 411 | {
|
|---|
| 412 | return INT_MIN;
|
|---|
| 413 | }
|
|---|
| 414 |
|
|---|
| 415 | static constexpr int lowest()
|
|---|
| 416 | {
|
|---|
| 417 | return min();
|
|---|
| 418 | }
|
|---|
| 419 | };
|
|---|
| 420 |
|
|---|
| 421 | template<>
|
|---|
| 422 | class numeric_limits<long>: public aux::numeric_limits<long>
|
|---|
| 423 | {
|
|---|
| 424 | public:
|
|---|
| 425 | static constexpr bool is_specialized = true;
|
|---|
| 426 |
|
|---|
| 427 | static constexpr int digits = sizeof(long) * 8 - 1;
|
|---|
| 428 |
|
|---|
| 429 | static constexpr long max()
|
|---|
| 430 | {
|
|---|
| 431 | return LONG_MAX;
|
|---|
| 432 | }
|
|---|
| 433 |
|
|---|
| 434 | static constexpr long min()
|
|---|
| 435 | {
|
|---|
| 436 | return LONG_MIN;
|
|---|
| 437 | }
|
|---|
| 438 |
|
|---|
| 439 | static constexpr long lowest()
|
|---|
| 440 | {
|
|---|
| 441 | return min();
|
|---|
| 442 | }
|
|---|
| 443 | };
|
|---|
| 444 |
|
|---|
| 445 | template<>
|
|---|
| 446 | class numeric_limits<long long>: public aux::numeric_limits<long long>
|
|---|
| 447 | {
|
|---|
| 448 | public:
|
|---|
| 449 | static constexpr bool is_specialized = true;
|
|---|
| 450 |
|
|---|
| 451 | static constexpr int digits = sizeof(long long) * 8 - 1;
|
|---|
| 452 |
|
|---|
| 453 | static constexpr long long max()
|
|---|
| 454 | {
|
|---|
| 455 | return LLONG_MAX;
|
|---|
| 456 | }
|
|---|
| 457 |
|
|---|
| 458 | static constexpr long long min()
|
|---|
| 459 | {
|
|---|
| 460 | return LLONG_MIN;
|
|---|
| 461 | }
|
|---|
| 462 |
|
|---|
| 463 | static constexpr long long lowest()
|
|---|
| 464 | {
|
|---|
| 465 | return min();
|
|---|
| 466 | }
|
|---|
| 467 | };
|
|---|
| 468 |
|
|---|
| 469 | template<>
|
|---|
| 470 | class numeric_limits<unsigned char>: public aux::numeric_limits<unsigned char>
|
|---|
| 471 | {
|
|---|
| 472 | public:
|
|---|
| 473 | static constexpr bool is_specialized = true;
|
|---|
| 474 |
|
|---|
| 475 | static constexpr int digits = sizeof(unsigned char) * 8;
|
|---|
| 476 |
|
|---|
| 477 | static constexpr unsigned char max()
|
|---|
| 478 | {
|
|---|
| 479 | return SCHAR_MAX;
|
|---|
| 480 | }
|
|---|
| 481 |
|
|---|
| 482 | static constexpr unsigned char min()
|
|---|
| 483 | {
|
|---|
| 484 | return SCHAR_MIN;
|
|---|
| 485 | }
|
|---|
| 486 |
|
|---|
| 487 | static constexpr unsigned char lowest()
|
|---|
| 488 | {
|
|---|
| 489 | return min();
|
|---|
| 490 | }
|
|---|
| 491 | };
|
|---|
| 492 |
|
|---|
| 493 | template<>
|
|---|
| 494 | class numeric_limits<unsigned short>: public aux::numeric_limits<unsigned short>
|
|---|
| 495 | {
|
|---|
| 496 | public:
|
|---|
| 497 | static constexpr bool is_specialized = true;
|
|---|
| 498 |
|
|---|
| 499 | static constexpr int digits = sizeof(unsigned short) * 8;
|
|---|
| 500 |
|
|---|
| 501 | static constexpr unsigned short max()
|
|---|
| 502 | {
|
|---|
| 503 | return USHRT_MAX;
|
|---|
| 504 | }
|
|---|
| 505 |
|
|---|
| 506 | static constexpr unsigned short min()
|
|---|
| 507 | {
|
|---|
| 508 | return 0;
|
|---|
| 509 | }
|
|---|
| 510 |
|
|---|
| 511 | static constexpr unsigned short lowest()
|
|---|
| 512 | {
|
|---|
| 513 | return min();
|
|---|
| 514 | }
|
|---|
| 515 | };
|
|---|
| 516 |
|
|---|
| 517 | template<>
|
|---|
| 518 | class numeric_limits<unsigned int>: public aux::numeric_limits<unsigned int>
|
|---|
| 519 | {
|
|---|
| 520 | public:
|
|---|
| 521 | static constexpr bool is_specialized = true;
|
|---|
| 522 |
|
|---|
| 523 | static constexpr int digits = sizeof(unsigned int) * 8;
|
|---|
| 524 |
|
|---|
| 525 | static constexpr unsigned int max()
|
|---|
| 526 | {
|
|---|
| 527 | return UINT_MAX;
|
|---|
| 528 | }
|
|---|
| 529 |
|
|---|
| 530 | static constexpr unsigned int min()
|
|---|
| 531 | {
|
|---|
| 532 | return 0;
|
|---|
| 533 | }
|
|---|
| 534 |
|
|---|
| 535 | static constexpr unsigned int lowest()
|
|---|
| 536 | {
|
|---|
| 537 | return min();
|
|---|
| 538 | }
|
|---|
| 539 | };
|
|---|
| 540 |
|
|---|
| 541 | template<>
|
|---|
| 542 | class numeric_limits<unsigned long>: public aux::numeric_limits<unsigned long>
|
|---|
| 543 | {
|
|---|
| 544 | public:
|
|---|
| 545 | static constexpr bool is_specialized = true;
|
|---|
| 546 |
|
|---|
| 547 | static constexpr int digits = sizeof(unsigned long) * 8;
|
|---|
| 548 |
|
|---|
| 549 | static constexpr unsigned long max()
|
|---|
| 550 | {
|
|---|
| 551 | return ULONG_MAX;
|
|---|
| 552 | }
|
|---|
| 553 |
|
|---|
| 554 | static constexpr unsigned long min()
|
|---|
| 555 | {
|
|---|
| 556 | return 0;
|
|---|
| 557 | }
|
|---|
| 558 |
|
|---|
| 559 | static constexpr unsigned long lowest()
|
|---|
| 560 | {
|
|---|
| 561 | return min();
|
|---|
| 562 | }
|
|---|
| 563 | };
|
|---|
| 564 |
|
|---|
| 565 | template<>
|
|---|
| 566 | class numeric_limits<unsigned long long>: public aux::numeric_limits<unsigned long long>
|
|---|
| 567 | {
|
|---|
| 568 | public:
|
|---|
| 569 | static constexpr bool is_specialized = true;
|
|---|
| 570 |
|
|---|
| 571 | static constexpr int digits = sizeof(unsigned long long) * 8;
|
|---|
| 572 |
|
|---|
| 573 | static constexpr unsigned long long max()
|
|---|
| 574 | {
|
|---|
| 575 | return ULLONG_MAX;
|
|---|
| 576 | }
|
|---|
| 577 |
|
|---|
| 578 | static constexpr unsigned long long min()
|
|---|
| 579 | {
|
|---|
| 580 | return 0;
|
|---|
| 581 | }
|
|---|
| 582 |
|
|---|
| 583 | static constexpr unsigned long long lowest()
|
|---|
| 584 | {
|
|---|
| 585 | return min();
|
|---|
| 586 | }
|
|---|
| 587 | };
|
|---|
| 588 |
|
|---|
| 589 | template<>
|
|---|
| 590 | class numeric_limits<double>: public aux::numeric_limits<double>
|
|---|
| 591 | {
|
|---|
| 592 | public:
|
|---|
| 593 | // TODO: implement
|
|---|
| 594 | static constexpr int digits = sizeof(short) * 8 - 1;
|
|---|
| 595 | };
|
|---|
| 596 |
|
|---|
| 597 | template<>
|
|---|
| 598 | class numeric_limits<long double>: public aux::numeric_limits<long double>
|
|---|
| 599 | {
|
|---|
| 600 | public:
|
|---|
| 601 | // TODO: implement
|
|---|
| 602 | };
|
|---|
| 603 | }
|
|---|
| 604 |
|
|---|
| 605 | #endif
|
|---|