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