blob: 989964e0a6aae336100b79be0e2da6404b96bd3d [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001// -*- C++ -*-
2//===---------------------------- limits ----------------------------------===//
3//
Howard Hinnantf5256e12010-05-11 21:36:01 +00004// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00005//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00006// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00008//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP_LIMITS
12#define _LIBCPP_LIMITS
13
14/*
15 limits synopsis
16
17namespace std
18{
19
20template<class T>
21class numeric_limits
22{
23public:
24 static const bool is_specialized = false;
Howard Hinnanted569212011-05-26 18:23:59 +000025 static T min() noexcept;
26 static T max() noexcept;
27 static T lowest() noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000028
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;
Howard Hinnanted569212011-05-26 18:23:59 +000036 static T epsilon() noexcept;
37 static T round_error() noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000038
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;
Howard Hinnanted569212011-05-26 18:23:59 +000049 static T infinity() noexcept;
50 static T quiet_NaN() noexcept;
51 static T signaling_NaN() noexcept;
52 static T denorm_min() noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000053
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
63enum 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
72enum float_denorm_style
73{
74 denorm_indeterminate = -1,
75 denorm_absent = 0,
76 denorm_present = 1
77};
78
79template<> class numeric_limits<cv bool>;
80
81template<> class numeric_limits<cv char>;
82template<> class numeric_limits<cv signed char>;
83template<> class numeric_limits<cv unsigned char>;
84template<> class numeric_limits<cv wchar_t>;
85template<> class numeric_limits<cv char16_t>;
86template<> class numeric_limits<cv char32_t>;
87
88template<> class numeric_limits<cv short>;
89template<> class numeric_limits<cv int>;
90template<> class numeric_limits<cv long>;
91template<> class numeric_limits<cv long long>;
92template<> class numeric_limits<cv unsigned short>;
93template<> class numeric_limits<cv unsigned int>;
94template<> class numeric_limits<cv unsigned long>;
95template<> class numeric_limits<cv unsigned long long>;
96
97template<> class numeric_limits<cv float>;
98template<> class numeric_limits<cv double>;
99template<> 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
112enum 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
121enum float_denorm_style
122{
123 denorm_indeterminate = -1,
124 denorm_absent = 0,
125 denorm_present = 1
126};
127
128template <class _Tp, bool = is_arithmetic<_Tp>::value>
129class __libcpp_numeric_limits
130{
131protected:
132 typedef _Tp type;
133
134 static const bool is_specialized = false;
Howard Hinnanted569212011-05-26 18:23:59 +0000135 _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return type();}
136 _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return type();}
137 _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return type();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000138
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000146 _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type();}
147 _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000148
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000159 _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type();}
160 _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type();}
161 _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type();}
162 _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000163
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
173template <class _Tp, int digits, bool is_signed>
174struct __libcpp_compute_min
175{
176 static const _Tp value = _Tp(_Tp(1) << digits);
177};
178
179template <class _Tp, int digits>
180struct __libcpp_compute_min<_Tp, digits, false>
181{
182 static const _Tp value = _Tp(0);
183};
184
185template <class _Tp>
186class __libcpp_numeric_limits<_Tp, true>
187{
188protected:
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);
Howard Hinnanted569212011-05-26 18:23:59 +0000199 _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __min;}
200 _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __max;}
201 _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return min();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000202
203 static const bool is_integer = true;
204 static const bool is_exact = true;
205 static const int radix = 2;
Howard Hinnanted569212011-05-26 18:23:59 +0000206 _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type(0);}
207 _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type(0);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000208
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000219 _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type(0);}
220 _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type(0);}
221 _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type(0);}
222 _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type(0);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000223
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
237template <>
238class __libcpp_numeric_limits<bool, true>
239{
240protected:
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000251 _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __min;}
252 _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __max;}
253 _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return min();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000254
255 static const bool is_integer = true;
256 static const bool is_exact = true;
257 static const int radix = 2;
Howard Hinnanted569212011-05-26 18:23:59 +0000258 _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type(0);}
259 _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type(0);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000260
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000271 _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type(0);}
272 _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type(0);}
273 _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type(0);}
274 _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type(0);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000275
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
285template <>
286class __libcpp_numeric_limits<float, true>
287{
288protected:
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000297 _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __FLT_MIN__;}
298 _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __FLT_MAX__;}
299 _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000300
301 static const bool is_integer = false;
302 static const bool is_exact = false;
303 static const int radix = __FLT_RADIX__;
Howard Hinnanted569212011-05-26 18:23:59 +0000304 _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __FLT_EPSILON__;}
305 _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5F;}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000306
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000317 _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_valf();}
318 _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nanf("");}
319 _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nansf("");}
320 _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __FLT_DENORM_MIN__;}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000321
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
331template <>
332class __libcpp_numeric_limits<double, true>
333{
334protected:
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000343 _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __DBL_MIN__;}
344 _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __DBL_MAX__;}
345 _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000346
347 static const bool is_integer = false;
348 static const bool is_exact = false;
349 static const int radix = __FLT_RADIX__;
Howard Hinnanted569212011-05-26 18:23:59 +0000350 _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __DBL_EPSILON__;}
351 _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5;}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000352
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000363 _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_val();}
364 _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nan("");}
365 _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nans("");}
366 _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __DBL_DENORM_MIN__;}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000367
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
377template <>
378class __libcpp_numeric_limits<long double, true>
379{
380protected:
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000389 _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __LDBL_MIN__;}
390 _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __LDBL_MAX__;}
391 _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000392
393 static const bool is_integer = false;
394 static const bool is_exact = false;
395 static const int radix = __FLT_RADIX__;
Howard Hinnanted569212011-05-26 18:23:59 +0000396 _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
397 _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5;}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000398
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000409 _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_vall();}
410 _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nanl("");}
411 _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
412 _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000413
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
427template <class _Tp>
Howard Hinnant82894812010-09-22 16:48:34 +0000428class _LIBCPP_VISIBLE numeric_limits
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000429 : 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;
433public:
434 static const bool is_specialized = __base::is_specialized;
Howard Hinnanted569212011-05-26 18:23:59 +0000435 _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
436 _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
437 _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000438
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000446 _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
447 _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000448
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000459 _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
460 _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
461 _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
462 _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000463
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
473template <class _Tp>
Howard Hinnant82894812010-09-22 16:48:34 +0000474class _LIBCPP_VISIBLE numeric_limits<const _Tp>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000475 : private numeric_limits<_Tp>
476{
477 typedef numeric_limits<_Tp> __base;
478 typedef _Tp type;
479public:
480 static const bool is_specialized = __base::is_specialized;
Howard Hinnanted569212011-05-26 18:23:59 +0000481 _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
482 _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
483 _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000484
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000492 _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
493 _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000494
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000505 _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
506 _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
507 _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
508 _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000509
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
519template <class _Tp>
Howard Hinnant82894812010-09-22 16:48:34 +0000520class _LIBCPP_VISIBLE numeric_limits<volatile _Tp>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000521 : private numeric_limits<_Tp>
522{
523 typedef numeric_limits<_Tp> __base;
524 typedef _Tp type;
525public:
526 static const bool is_specialized = __base::is_specialized;
Howard Hinnanted569212011-05-26 18:23:59 +0000527 _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
528 _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
529 _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000530
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000538 _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
539 _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000540
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000551 _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
552 _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
553 _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
554 _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000555
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
565template <class _Tp>
Howard Hinnant82894812010-09-22 16:48:34 +0000566class _LIBCPP_VISIBLE numeric_limits<const volatile _Tp>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000567 : private numeric_limits<_Tp>
568{
569 typedef numeric_limits<_Tp> __base;
570 typedef _Tp type;
571public:
572 static const bool is_specialized = __base::is_specialized;
Howard Hinnanted569212011-05-26 18:23:59 +0000573 _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
574 _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
575 _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000576
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000584 _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
585 _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000586
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;
Howard Hinnanted569212011-05-26 18:23:59 +0000597 _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
598 _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
599 _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
600 _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000601
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