Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===---------------------------- limits ----------------------------------===// |
| 3 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 5 | // |
| 6 | // This file is distributed under the University of Illinois Open Source |
| 7 | // License. See LICENSE.TXT for details. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP_LIMITS |
| 12 | #define _LIBCPP_LIMITS |
| 13 | |
| 14 | /* |
| 15 | limits synopsis |
| 16 | |
| 17 | namespace std |
| 18 | { |
| 19 | |
| 20 | template<class T> |
| 21 | class numeric_limits |
| 22 | { |
| 23 | public: |
| 24 | static const bool is_specialized = false; |
| 25 | static T min() throw(); |
| 26 | static T max() throw(); |
| 27 | static T lowest() throw(); |
| 28 | |
| 29 | static const int digits = 0; |
| 30 | static const int digits10 = 0; |
| 31 | static const int max_digits10 = 0; |
| 32 | static const bool is_signed = false; |
| 33 | static const bool is_integer = false; |
| 34 | static const bool is_exact = false; |
| 35 | static const int radix = 0; |
| 36 | static T epsilon() throw(); |
| 37 | static T round_error() throw(); |
| 38 | |
| 39 | static const int min_exponent = 0; |
| 40 | static const int min_exponent10 = 0; |
| 41 | static const int max_exponent = 0; |
| 42 | static const int max_exponent10 = 0; |
| 43 | |
| 44 | static const bool has_infinity = false; |
| 45 | static const bool has_quiet_NaN = false; |
| 46 | static const bool has_signaling_NaN = false; |
| 47 | static const float_denorm_style has_denorm = denorm_absent; |
| 48 | static const bool has_denorm_loss = false; |
| 49 | static T infinity() throw(); |
| 50 | static T quiet_NaN() throw(); |
| 51 | static T signaling_NaN() throw(); |
| 52 | static T denorm_min() throw(); |
| 53 | |
| 54 | static const bool is_iec559 = false; |
| 55 | static const bool is_bounded = false; |
| 56 | static const bool is_modulo = false; |
| 57 | |
| 58 | static const bool traps = false; |
| 59 | static const bool tinyness_before = false; |
| 60 | static const float_round_style round_style = round_toward_zero; |
| 61 | }; |
| 62 | |
| 63 | enum float_round_style |
| 64 | { |
| 65 | round_indeterminate = -1, |
| 66 | round_toward_zero = 0, |
| 67 | round_to_nearest = 1, |
| 68 | round_toward_infinity = 2, |
| 69 | round_toward_neg_infinity = 3 |
| 70 | }; |
| 71 | |
| 72 | enum float_denorm_style |
| 73 | { |
| 74 | denorm_indeterminate = -1, |
| 75 | denorm_absent = 0, |
| 76 | denorm_present = 1 |
| 77 | }; |
| 78 | |
| 79 | template<> class numeric_limits<cv bool>; |
| 80 | |
| 81 | template<> class numeric_limits<cv char>; |
| 82 | template<> class numeric_limits<cv signed char>; |
| 83 | template<> class numeric_limits<cv unsigned char>; |
| 84 | template<> class numeric_limits<cv wchar_t>; |
| 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 | #pragma GCC system_header |
| 106 | |
| 107 | #include <__config> |
| 108 | #include <type_traits> |
| 109 | |
| 110 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 111 | |
| 112 | enum float_round_style |
| 113 | { |
| 114 | round_indeterminate = -1, |
| 115 | round_toward_zero = 0, |
| 116 | round_to_nearest = 1, |
| 117 | round_toward_infinity = 2, |
| 118 | round_toward_neg_infinity = 3 |
| 119 | }; |
| 120 | |
| 121 | enum float_denorm_style |
| 122 | { |
| 123 | denorm_indeterminate = -1, |
| 124 | denorm_absent = 0, |
| 125 | denorm_present = 1 |
| 126 | }; |
| 127 | |
| 128 | template <class _Tp, bool = is_arithmetic<_Tp>::value> |
| 129 | class __libcpp_numeric_limits |
| 130 | { |
| 131 | protected: |
| 132 | typedef _Tp type; |
| 133 | |
| 134 | static const bool is_specialized = false; |
| 135 | _LIBCPP_INLINE_VISIBILITY static type min() throw() {return type();} |
| 136 | _LIBCPP_INLINE_VISIBILITY static type max() throw() {return type();} |
| 137 | _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return type();} |
| 138 | |
| 139 | static const int digits = 0; |
| 140 | static const int digits10 = 0; |
| 141 | static const int max_digits10 = 0; |
| 142 | static const bool is_signed = false; |
| 143 | static const bool is_integer = false; |
| 144 | static const bool is_exact = false; |
| 145 | static const int radix = 0; |
| 146 | _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return type();} |
| 147 | _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return type();} |
| 148 | |
| 149 | static const int min_exponent = 0; |
| 150 | static const int min_exponent10 = 0; |
| 151 | static const int max_exponent = 0; |
| 152 | static const int max_exponent10 = 0; |
| 153 | |
| 154 | static const bool has_infinity = false; |
| 155 | static const bool has_quiet_NaN = false; |
| 156 | static const bool has_signaling_NaN = false; |
| 157 | static const float_denorm_style has_denorm = denorm_absent; |
| 158 | static const bool has_denorm_loss = false; |
| 159 | _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return type();} |
| 160 | _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return type();} |
| 161 | _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return type();} |
| 162 | _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return type();} |
| 163 | |
| 164 | static const bool is_iec559 = false; |
| 165 | static const bool is_bounded = false; |
| 166 | static const bool is_modulo = false; |
| 167 | |
| 168 | static const bool traps = false; |
| 169 | static const bool tinyness_before = false; |
| 170 | static const float_round_style round_style = round_toward_zero; |
| 171 | }; |
| 172 | |
| 173 | template <class _Tp, int digits, bool is_signed> |
| 174 | struct __libcpp_compute_min |
| 175 | { |
| 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 | { |
| 182 | static const _Tp value = _Tp(0); |
| 183 | }; |
| 184 | |
| 185 | template <class _Tp> |
| 186 | class __libcpp_numeric_limits<_Tp, true> |
| 187 | { |
| 188 | protected: |
| 189 | typedef _Tp type; |
| 190 | |
| 191 | static const bool is_specialized = true; |
| 192 | |
| 193 | static const bool is_signed = type(-1) < type(0); |
| 194 | static const int digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed); |
| 195 | static const int digits10 = digits * 3 / 10; |
| 196 | static const int max_digits10 = 0; |
| 197 | static const type __min = __libcpp_compute_min<type, digits, is_signed>::value; |
| 198 | static const type __max = is_signed ? type(type(~0) ^ __min) : type(~0); |
| 199 | _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __min;} |
| 200 | _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __max;} |
| 201 | _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return min();} |
| 202 | |
| 203 | static const bool is_integer = true; |
| 204 | static const bool is_exact = true; |
| 205 | static const int radix = 2; |
| 206 | _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return type(0);} |
| 207 | _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return type(0);} |
| 208 | |
| 209 | static const int min_exponent = 0; |
| 210 | static const int min_exponent10 = 0; |
| 211 | static const int max_exponent = 0; |
| 212 | static const int max_exponent10 = 0; |
| 213 | |
| 214 | static const bool has_infinity = false; |
| 215 | static const bool has_quiet_NaN = false; |
| 216 | static const bool has_signaling_NaN = false; |
| 217 | static const float_denorm_style has_denorm = denorm_absent; |
| 218 | static const bool has_denorm_loss = false; |
| 219 | _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return type(0);} |
| 220 | _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return type(0);} |
| 221 | _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return type(0);} |
| 222 | _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return type(0);} |
| 223 | |
| 224 | static const bool is_iec559 = false; |
| 225 | static const bool is_bounded = true; |
| 226 | static const bool is_modulo = true; |
| 227 | |
| 228 | #if __i386__ || __x86_64__ |
| 229 | static const bool traps = true; |
| 230 | #else |
| 231 | static const bool traps = false; |
| 232 | #endif |
| 233 | static const bool tinyness_before = false; |
| 234 | static const float_round_style round_style = round_toward_zero; |
| 235 | }; |
| 236 | |
| 237 | template <> |
| 238 | class __libcpp_numeric_limits<bool, true> |
| 239 | { |
| 240 | protected: |
| 241 | typedef bool type; |
| 242 | |
| 243 | static const bool is_specialized = true; |
| 244 | |
| 245 | static const bool is_signed = false; |
| 246 | static const int digits = 1; |
| 247 | static const int digits10 = 0; |
| 248 | static const int max_digits10 = 0; |
| 249 | static const type __min = false; |
| 250 | static const type __max = true; |
| 251 | _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __min;} |
| 252 | _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __max;} |
| 253 | _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return min();} |
| 254 | |
| 255 | static const bool is_integer = true; |
| 256 | static const bool is_exact = true; |
| 257 | static const int radix = 2; |
| 258 | _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return type(0);} |
| 259 | _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return type(0);} |
| 260 | |
| 261 | static const int min_exponent = 0; |
| 262 | static const int min_exponent10 = 0; |
| 263 | static const int max_exponent = 0; |
| 264 | static const int max_exponent10 = 0; |
| 265 | |
| 266 | static const bool has_infinity = false; |
| 267 | static const bool has_quiet_NaN = false; |
| 268 | static const bool has_signaling_NaN = false; |
| 269 | static const float_denorm_style has_denorm = denorm_absent; |
| 270 | static const bool has_denorm_loss = false; |
| 271 | _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return type(0);} |
| 272 | _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return type(0);} |
| 273 | _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return type(0);} |
| 274 | _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return type(0);} |
| 275 | |
| 276 | static const bool is_iec559 = false; |
| 277 | static const bool is_bounded = true; |
| 278 | static const bool is_modulo = false; |
| 279 | |
| 280 | static const bool traps = false; |
| 281 | static const bool tinyness_before = false; |
| 282 | static const float_round_style round_style = round_toward_zero; |
| 283 | }; |
| 284 | |
| 285 | template <> |
| 286 | class __libcpp_numeric_limits<float, true> |
| 287 | { |
| 288 | protected: |
| 289 | typedef float type; |
| 290 | |
| 291 | static const bool is_specialized = true; |
| 292 | |
| 293 | static const bool is_signed = true; |
| 294 | static const int digits = __FLT_MANT_DIG__; |
| 295 | static const int digits10 = __FLT_DIG__; |
| 296 | static const int max_digits10 = 2+(digits * 30103)/100000; |
| 297 | _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __FLT_MIN__;} |
| 298 | _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __FLT_MAX__;} |
| 299 | _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return -max();} |
| 300 | |
| 301 | static const bool is_integer = false; |
| 302 | static const bool is_exact = false; |
| 303 | static const int radix = __FLT_RADIX__; |
| 304 | _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __FLT_EPSILON__;} |
| 305 | _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return 0.5F;} |
| 306 | |
| 307 | static const int min_exponent = __FLT_MIN_EXP__; |
| 308 | static const int min_exponent10 = __FLT_MIN_10_EXP__; |
| 309 | static const int max_exponent = __FLT_MAX_EXP__; |
| 310 | static const int max_exponent10 = __FLT_MAX_10_EXP__; |
| 311 | |
| 312 | static const bool has_infinity = true; |
| 313 | static const bool has_quiet_NaN = true; |
| 314 | static const bool has_signaling_NaN = true; |
| 315 | static const float_denorm_style has_denorm = denorm_present; |
| 316 | static const bool has_denorm_loss = false; |
| 317 | _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __builtin_huge_valf();} |
| 318 | _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __builtin_nanf("");} |
| 319 | _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __builtin_nansf("");} |
| 320 | _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __FLT_DENORM_MIN__;} |
| 321 | |
| 322 | static const bool is_iec559 = true; |
| 323 | static const bool is_bounded = true; |
| 324 | static const bool is_modulo = false; |
| 325 | |
| 326 | static const bool traps = false; |
| 327 | static const bool tinyness_before = false; |
| 328 | static const float_round_style round_style = round_to_nearest; |
| 329 | }; |
| 330 | |
| 331 | template <> |
| 332 | class __libcpp_numeric_limits<double, true> |
| 333 | { |
| 334 | protected: |
| 335 | typedef double type; |
| 336 | |
| 337 | static const bool is_specialized = true; |
| 338 | |
| 339 | static const bool is_signed = true; |
| 340 | static const int digits = __DBL_MANT_DIG__; |
| 341 | static const int digits10 = __DBL_DIG__; |
| 342 | static const int max_digits10 = 2+(digits * 30103)/100000; |
| 343 | _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __DBL_MIN__;} |
| 344 | _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __DBL_MAX__;} |
| 345 | _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return -max();} |
| 346 | |
| 347 | static const bool is_integer = false; |
| 348 | static const bool is_exact = false; |
| 349 | static const int radix = __FLT_RADIX__; |
| 350 | _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __DBL_EPSILON__;} |
| 351 | _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return 0.5;} |
| 352 | |
| 353 | static const int min_exponent = __DBL_MIN_EXP__; |
| 354 | static const int min_exponent10 = __DBL_MIN_10_EXP__; |
| 355 | static const int max_exponent = __DBL_MAX_EXP__; |
| 356 | static const int max_exponent10 = __DBL_MAX_10_EXP__; |
| 357 | |
| 358 | static const bool has_infinity = true; |
| 359 | static const bool has_quiet_NaN = true; |
| 360 | static const bool has_signaling_NaN = true; |
| 361 | static const float_denorm_style has_denorm = denorm_present; |
| 362 | static const bool has_denorm_loss = false; |
| 363 | _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __builtin_huge_val();} |
| 364 | _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __builtin_nan("");} |
| 365 | _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __builtin_nans("");} |
| 366 | _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __DBL_DENORM_MIN__;} |
| 367 | |
| 368 | static const bool is_iec559 = true; |
| 369 | static const bool is_bounded = true; |
| 370 | static const bool is_modulo = false; |
| 371 | |
| 372 | static const bool traps = false; |
| 373 | static const bool tinyness_before = false; |
| 374 | static const float_round_style round_style = round_to_nearest; |
| 375 | }; |
| 376 | |
| 377 | template <> |
| 378 | class __libcpp_numeric_limits<long double, true> |
| 379 | { |
| 380 | protected: |
| 381 | typedef long double type; |
| 382 | |
| 383 | static const bool is_specialized = true; |
| 384 | |
| 385 | static const bool is_signed = true; |
| 386 | static const int digits = __LDBL_MANT_DIG__; |
| 387 | static const int digits10 = __LDBL_DIG__; |
| 388 | static const int max_digits10 = 2+(digits * 30103)/100000; |
| 389 | _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __LDBL_MIN__;} |
| 390 | _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __LDBL_MAX__;} |
| 391 | _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return -max();} |
| 392 | |
| 393 | static const bool is_integer = false; |
| 394 | static const bool is_exact = false; |
| 395 | static const int radix = __FLT_RADIX__; |
| 396 | _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __LDBL_EPSILON__;} |
| 397 | _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return 0.5;} |
| 398 | |
| 399 | static const int min_exponent = __LDBL_MIN_EXP__; |
| 400 | static const int min_exponent10 = __LDBL_MIN_10_EXP__; |
| 401 | static const int max_exponent = __LDBL_MAX_EXP__; |
| 402 | static const int max_exponent10 = __LDBL_MAX_10_EXP__; |
| 403 | |
| 404 | static const bool has_infinity = true; |
| 405 | static const bool has_quiet_NaN = true; |
| 406 | static const bool has_signaling_NaN = true; |
| 407 | static const float_denorm_style has_denorm = denorm_present; |
| 408 | static const bool has_denorm_loss = false; |
| 409 | _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __builtin_huge_vall();} |
| 410 | _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __builtin_nanl("");} |
| 411 | _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __builtin_nansl("");} |
| 412 | _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __LDBL_DENORM_MIN__;} |
| 413 | |
| 414 | #if (defined(__ppc__) || defined(__ppc64__)) |
| 415 | static const bool is_iec559 = false; |
| 416 | #else |
| 417 | static const bool is_iec559 = true; |
| 418 | #endif |
| 419 | static const bool is_bounded = true; |
| 420 | static const bool is_modulo = false; |
| 421 | |
| 422 | static const bool traps = false; |
| 423 | static const bool tinyness_before = false; |
| 424 | static const float_round_style round_style = round_to_nearest; |
| 425 | }; |
| 426 | |
| 427 | template <class _Tp> |
Howard Hinnant | 8289481 | 2010-09-22 16:48:34 +0000 | [diff] [blame] | 428 | class _LIBCPP_VISIBLE numeric_limits |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 429 | : private __libcpp_numeric_limits<typename remove_cv<_Tp>::type> |
| 430 | { |
| 431 | typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base; |
| 432 | typedef typename __base::type type; |
| 433 | public: |
| 434 | static const bool is_specialized = __base::is_specialized; |
| 435 | _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();} |
| 436 | _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();} |
| 437 | _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();} |
| 438 | |
| 439 | static const int digits = __base::digits; |
| 440 | static const int digits10 = __base::digits10; |
| 441 | static const int max_digits10 = __base::max_digits10; |
| 442 | static const bool is_signed = __base::is_signed; |
| 443 | static const bool is_integer = __base::is_integer; |
| 444 | static const bool is_exact = __base::is_exact; |
| 445 | static const int radix = __base::radix; |
| 446 | _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();} |
| 447 | _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();} |
| 448 | |
| 449 | static const int min_exponent = __base::min_exponent; |
| 450 | static const int min_exponent10 = __base::min_exponent10; |
| 451 | static const int max_exponent = __base::max_exponent; |
| 452 | static const int max_exponent10 = __base::max_exponent10; |
| 453 | |
| 454 | static const bool has_infinity = __base::has_infinity; |
| 455 | static const bool has_quiet_NaN = __base::has_quiet_NaN; |
| 456 | static const bool has_signaling_NaN = __base::has_signaling_NaN; |
| 457 | static const float_denorm_style has_denorm = __base::has_denorm; |
| 458 | static const bool has_denorm_loss = __base::has_denorm_loss; |
| 459 | _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();} |
| 460 | _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();} |
| 461 | _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();} |
| 462 | _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();} |
| 463 | |
| 464 | static const bool is_iec559 = __base::is_iec559; |
| 465 | static const bool is_bounded = __base::is_bounded; |
| 466 | static const bool is_modulo = __base::is_modulo; |
| 467 | |
| 468 | static const bool traps = __base::traps; |
| 469 | static const bool tinyness_before = __base::tinyness_before; |
| 470 | static const float_round_style round_style = __base::round_style; |
| 471 | }; |
| 472 | |
| 473 | template <class _Tp> |
Howard Hinnant | 8289481 | 2010-09-22 16:48:34 +0000 | [diff] [blame] | 474 | class _LIBCPP_VISIBLE numeric_limits<const _Tp> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 475 | : private numeric_limits<_Tp> |
| 476 | { |
| 477 | typedef numeric_limits<_Tp> __base; |
| 478 | typedef _Tp type; |
| 479 | public: |
| 480 | static const bool is_specialized = __base::is_specialized; |
| 481 | _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();} |
| 482 | _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();} |
| 483 | _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();} |
| 484 | |
| 485 | static const int digits = __base::digits; |
| 486 | static const int digits10 = __base::digits10; |
| 487 | static const int max_digits10 = __base::max_digits10; |
| 488 | static const bool is_signed = __base::is_signed; |
| 489 | static const bool is_integer = __base::is_integer; |
| 490 | static const bool is_exact = __base::is_exact; |
| 491 | static const int radix = __base::radix; |
| 492 | _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();} |
| 493 | _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();} |
| 494 | |
| 495 | static const int min_exponent = __base::min_exponent; |
| 496 | static const int min_exponent10 = __base::min_exponent10; |
| 497 | static const int max_exponent = __base::max_exponent; |
| 498 | static const int max_exponent10 = __base::max_exponent10; |
| 499 | |
| 500 | static const bool has_infinity = __base::has_infinity; |
| 501 | static const bool has_quiet_NaN = __base::has_quiet_NaN; |
| 502 | static const bool has_signaling_NaN = __base::has_signaling_NaN; |
| 503 | static const float_denorm_style has_denorm = __base::has_denorm; |
| 504 | static const bool has_denorm_loss = __base::has_denorm_loss; |
| 505 | _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();} |
| 506 | _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();} |
| 507 | _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();} |
| 508 | _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();} |
| 509 | |
| 510 | static const bool is_iec559 = __base::is_iec559; |
| 511 | static const bool is_bounded = __base::is_bounded; |
| 512 | static const bool is_modulo = __base::is_modulo; |
| 513 | |
| 514 | static const bool traps = __base::traps; |
| 515 | static const bool tinyness_before = __base::tinyness_before; |
| 516 | static const float_round_style round_style = __base::round_style; |
| 517 | }; |
| 518 | |
| 519 | template <class _Tp> |
Howard Hinnant | 8289481 | 2010-09-22 16:48:34 +0000 | [diff] [blame] | 520 | class _LIBCPP_VISIBLE numeric_limits<volatile _Tp> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 521 | : private numeric_limits<_Tp> |
| 522 | { |
| 523 | typedef numeric_limits<_Tp> __base; |
| 524 | typedef _Tp type; |
| 525 | public: |
| 526 | static const bool is_specialized = __base::is_specialized; |
| 527 | _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();} |
| 528 | _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();} |
| 529 | _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();} |
| 530 | |
| 531 | static const int digits = __base::digits; |
| 532 | static const int digits10 = __base::digits10; |
| 533 | static const int max_digits10 = __base::max_digits10; |
| 534 | static const bool is_signed = __base::is_signed; |
| 535 | static const bool is_integer = __base::is_integer; |
| 536 | static const bool is_exact = __base::is_exact; |
| 537 | static const int radix = __base::radix; |
| 538 | _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();} |
| 539 | _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();} |
| 540 | |
| 541 | static const int min_exponent = __base::min_exponent; |
| 542 | static const int min_exponent10 = __base::min_exponent10; |
| 543 | static const int max_exponent = __base::max_exponent; |
| 544 | static const int max_exponent10 = __base::max_exponent10; |
| 545 | |
| 546 | static const bool has_infinity = __base::has_infinity; |
| 547 | static const bool has_quiet_NaN = __base::has_quiet_NaN; |
| 548 | static const bool has_signaling_NaN = __base::has_signaling_NaN; |
| 549 | static const float_denorm_style has_denorm = __base::has_denorm; |
| 550 | static const bool has_denorm_loss = __base::has_denorm_loss; |
| 551 | _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();} |
| 552 | _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();} |
| 553 | _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();} |
| 554 | _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();} |
| 555 | |
| 556 | static const bool is_iec559 = __base::is_iec559; |
| 557 | static const bool is_bounded = __base::is_bounded; |
| 558 | static const bool is_modulo = __base::is_modulo; |
| 559 | |
| 560 | static const bool traps = __base::traps; |
| 561 | static const bool tinyness_before = __base::tinyness_before; |
| 562 | static const float_round_style round_style = __base::round_style; |
| 563 | }; |
| 564 | |
| 565 | template <class _Tp> |
Howard Hinnant | 8289481 | 2010-09-22 16:48:34 +0000 | [diff] [blame] | 566 | class _LIBCPP_VISIBLE numeric_limits<const volatile _Tp> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 567 | : private numeric_limits<_Tp> |
| 568 | { |
| 569 | typedef numeric_limits<_Tp> __base; |
| 570 | typedef _Tp type; |
| 571 | public: |
| 572 | static const bool is_specialized = __base::is_specialized; |
| 573 | _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();} |
| 574 | _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();} |
| 575 | _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();} |
| 576 | |
| 577 | static const int digits = __base::digits; |
| 578 | static const int digits10 = __base::digits10; |
| 579 | static const int max_digits10 = __base::max_digits10; |
| 580 | static const bool is_signed = __base::is_signed; |
| 581 | static const bool is_integer = __base::is_integer; |
| 582 | static const bool is_exact = __base::is_exact; |
| 583 | static const int radix = __base::radix; |
| 584 | _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();} |
| 585 | _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();} |
| 586 | |
| 587 | static const int min_exponent = __base::min_exponent; |
| 588 | static const int min_exponent10 = __base::min_exponent10; |
| 589 | static const int max_exponent = __base::max_exponent; |
| 590 | static const int max_exponent10 = __base::max_exponent10; |
| 591 | |
| 592 | static const bool has_infinity = __base::has_infinity; |
| 593 | static const bool has_quiet_NaN = __base::has_quiet_NaN; |
| 594 | static const bool has_signaling_NaN = __base::has_signaling_NaN; |
| 595 | static const float_denorm_style has_denorm = __base::has_denorm; |
| 596 | static const bool has_denorm_loss = __base::has_denorm_loss; |
| 597 | _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();} |
| 598 | _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();} |
| 599 | _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();} |
| 600 | _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();} |
| 601 | |
| 602 | static const bool is_iec559 = __base::is_iec559; |
| 603 | static const bool is_bounded = __base::is_bounded; |
| 604 | static const bool is_modulo = __base::is_modulo; |
| 605 | |
| 606 | static const bool traps = __base::traps; |
| 607 | static const bool tinyness_before = __base::tinyness_before; |
| 608 | static const float_round_style round_style = __base::round_style; |
| 609 | }; |
| 610 | |
| 611 | _LIBCPP_END_NAMESPACE_STD |
| 612 | |
| 613 | #endif // _LIBCPP_LIMITS |