1 | // -*- C++ -*- |
2 | //===----------------------------------------------------------------------===// |
3 | // |
4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
5 | // See https://llvm.org/LICENSE.txt for license information. |
6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
7 | // |
8 | //===----------------------------------------------------------------------===// |
9 | |
10 | #ifndef _LIBCPP_LIMITS |
11 | #define _LIBCPP_LIMITS |
12 | |
13 | /* |
14 | limits synopsis |
15 | |
16 | namespace std |
17 | { |
18 | |
19 | template<class T> |
20 | class numeric_limits |
21 | { |
22 | public: |
23 | static constexpr bool is_specialized = false; |
24 | static constexpr T min() noexcept; |
25 | static constexpr T max() noexcept; |
26 | static constexpr T lowest() noexcept; |
27 | |
28 | static constexpr int digits = 0; |
29 | static constexpr int digits10 = 0; |
30 | static constexpr int max_digits10 = 0; |
31 | static constexpr bool is_signed = false; |
32 | static constexpr bool is_integer = false; |
33 | static constexpr bool is_exact = false; |
34 | static constexpr int radix = 0; |
35 | static constexpr T epsilon() noexcept; |
36 | static constexpr T round_error() noexcept; |
37 | |
38 | static constexpr int min_exponent = 0; |
39 | static constexpr int min_exponent10 = 0; |
40 | static constexpr int max_exponent = 0; |
41 | static constexpr int max_exponent10 = 0; |
42 | |
43 | static constexpr bool has_infinity = false; |
44 | static constexpr bool has_quiet_NaN = false; |
45 | static constexpr bool has_signaling_NaN = false; |
46 | static constexpr float_denorm_style has_denorm = denorm_absent; |
47 | static constexpr bool has_denorm_loss = false; |
48 | static constexpr T infinity() noexcept; |
49 | static constexpr T quiet_NaN() noexcept; |
50 | static constexpr T signaling_NaN() noexcept; |
51 | static constexpr T denorm_min() noexcept; |
52 | |
53 | static constexpr bool is_iec559 = false; |
54 | static constexpr bool is_bounded = false; |
55 | static constexpr bool is_modulo = false; |
56 | |
57 | static constexpr bool traps = false; |
58 | static constexpr bool tinyness_before = false; |
59 | static constexpr float_round_style round_style = round_toward_zero; |
60 | }; |
61 | |
62 | enum float_round_style |
63 | { |
64 | round_indeterminate = -1, |
65 | round_toward_zero = 0, |
66 | round_to_nearest = 1, |
67 | round_toward_infinity = 2, |
68 | round_toward_neg_infinity = 3 |
69 | }; |
70 | |
71 | enum float_denorm_style |
72 | { |
73 | denorm_indeterminate = -1, |
74 | denorm_absent = 0, |
75 | denorm_present = 1 |
76 | }; |
77 | |
78 | template<> class numeric_limits<cv bool>; |
79 | |
80 | template<> class numeric_limits<cv char>; |
81 | template<> class numeric_limits<cv signed char>; |
82 | template<> class numeric_limits<cv unsigned char>; |
83 | template<> class numeric_limits<cv wchar_t>; |
84 | template<> class numeric_limits<cv char8_t>; // C++20 |
85 | template<> class numeric_limits<cv char16_t>; |
86 | template<> class numeric_limits<cv char32_t>; |
87 | |
88 | template<> class numeric_limits<cv short>; |
89 | template<> class numeric_limits<cv int>; |
90 | template<> class numeric_limits<cv long>; |
91 | template<> class numeric_limits<cv long long>; |
92 | template<> class numeric_limits<cv unsigned short>; |
93 | template<> class numeric_limits<cv unsigned int>; |
94 | template<> class numeric_limits<cv unsigned long>; |
95 | template<> class numeric_limits<cv unsigned long long>; |
96 | |
97 | template<> class numeric_limits<cv float>; |
98 | template<> class numeric_limits<cv double>; |
99 | template<> class numeric_limits<cv long double>; |
100 | |
101 | } // std |
102 | |
103 | */ |
104 | |
105 | #include <__assert> // all public C++ headers provide the assertion handler |
106 | #include <__config> |
107 | #include <type_traits> |
108 | |
109 | #if defined(_LIBCPP_COMPILER_MSVC) |
110 | #include "__support/win32/limits_msvc_win32.h" |
111 | #endif // _LIBCPP_MSVCRT |
112 | |
113 | #if defined(__IBMCPP__) |
114 | #include "__support/ibm/limits.h" |
115 | #endif // __IBMCPP__ |
116 | |
117 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
118 | # pragma GCC system_header |
119 | #endif |
120 | |
121 | _LIBCPP_PUSH_MACROS |
122 | #include <__undef_macros> |
123 | #include <version> |
124 | |
125 | |
126 | _LIBCPP_BEGIN_NAMESPACE_STD |
127 | |
128 | enum float_round_style |
129 | { |
130 | round_indeterminate = -1, |
131 | round_toward_zero = 0, |
132 | round_to_nearest = 1, |
133 | round_toward_infinity = 2, |
134 | round_toward_neg_infinity = 3 |
135 | }; |
136 | |
137 | enum float_denorm_style |
138 | { |
139 | denorm_indeterminate = -1, |
140 | denorm_absent = 0, |
141 | denorm_present = 1 |
142 | }; |
143 | |
144 | template <class _Tp, bool = is_arithmetic<_Tp>::value> |
145 | class __libcpp_numeric_limits |
146 | { |
147 | protected: |
148 | typedef _Tp type; |
149 | |
150 | static _LIBCPP_CONSTEXPR const bool is_specialized = false; |
151 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return type();} |
152 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return type();} |
153 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return type();} |
154 | |
155 | static _LIBCPP_CONSTEXPR const int digits = 0; |
156 | static _LIBCPP_CONSTEXPR const int digits10 = 0; |
157 | static _LIBCPP_CONSTEXPR const int max_digits10 = 0; |
158 | static _LIBCPP_CONSTEXPR const bool is_signed = false; |
159 | static _LIBCPP_CONSTEXPR const bool is_integer = false; |
160 | static _LIBCPP_CONSTEXPR const bool is_exact = false; |
161 | static _LIBCPP_CONSTEXPR const int radix = 0; |
162 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type();} |
163 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type();} |
164 | |
165 | static _LIBCPP_CONSTEXPR const int min_exponent = 0; |
166 | static _LIBCPP_CONSTEXPR const int min_exponent10 = 0; |
167 | static _LIBCPP_CONSTEXPR const int max_exponent = 0; |
168 | static _LIBCPP_CONSTEXPR const int max_exponent10 = 0; |
169 | |
170 | static _LIBCPP_CONSTEXPR const bool has_infinity = false; |
171 | static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false; |
172 | static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false; |
173 | static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent; |
174 | static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; |
175 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type();} |
176 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type();} |
177 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type();} |
178 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type();} |
179 | |
180 | static _LIBCPP_CONSTEXPR const bool is_iec559 = false; |
181 | static _LIBCPP_CONSTEXPR const bool is_bounded = false; |
182 | static _LIBCPP_CONSTEXPR const bool is_modulo = false; |
183 | |
184 | static _LIBCPP_CONSTEXPR const bool traps = false; |
185 | static _LIBCPP_CONSTEXPR const bool tinyness_before = false; |
186 | static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero; |
187 | }; |
188 | |
189 | template <class _Tp, int __digits, bool _IsSigned> |
190 | struct __libcpp_compute_min |
191 | { |
192 | static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << __digits); |
193 | }; |
194 | |
195 | template <class _Tp, int __digits> |
196 | struct __libcpp_compute_min<_Tp, __digits, false> |
197 | { |
198 | static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0); |
199 | }; |
200 | |
201 | template <class _Tp> |
202 | class __libcpp_numeric_limits<_Tp, true> |
203 | { |
204 | protected: |
205 | typedef _Tp type; |
206 | |
207 | static _LIBCPP_CONSTEXPR const bool is_specialized = true; |
208 | |
209 | static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0); |
210 | static _LIBCPP_CONSTEXPR const int digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed); |
211 | static _LIBCPP_CONSTEXPR const int digits10 = digits * 3 / 10; |
212 | static _LIBCPP_CONSTEXPR const int max_digits10 = 0; |
213 | static _LIBCPP_CONSTEXPR const type __min = __libcpp_compute_min<type, digits, is_signed>::value; |
214 | static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0); |
215 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;} |
216 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;} |
217 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();} |
218 | |
219 | static _LIBCPP_CONSTEXPR const bool is_integer = true; |
220 | static _LIBCPP_CONSTEXPR const bool is_exact = true; |
221 | static _LIBCPP_CONSTEXPR const int radix = 2; |
222 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);} |
223 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);} |
224 | |
225 | static _LIBCPP_CONSTEXPR const int min_exponent = 0; |
226 | static _LIBCPP_CONSTEXPR const int min_exponent10 = 0; |
227 | static _LIBCPP_CONSTEXPR const int max_exponent = 0; |
228 | static _LIBCPP_CONSTEXPR const int max_exponent10 = 0; |
229 | |
230 | static _LIBCPP_CONSTEXPR const bool has_infinity = false; |
231 | static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false; |
232 | static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false; |
233 | static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent; |
234 | static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; |
235 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);} |
236 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);} |
237 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);} |
238 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);} |
239 | |
240 | static _LIBCPP_CONSTEXPR const bool is_iec559 = false; |
241 | static _LIBCPP_CONSTEXPR const bool is_bounded = true; |
242 | static _LIBCPP_CONSTEXPR const bool is_modulo = !_VSTD::is_signed<_Tp>::value; |
243 | |
244 | #if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || \ |
245 | defined(__wasm__) |
246 | static _LIBCPP_CONSTEXPR const bool traps = true; |
247 | #else |
248 | static _LIBCPP_CONSTEXPR const bool traps = false; |
249 | #endif |
250 | static _LIBCPP_CONSTEXPR const bool tinyness_before = false; |
251 | static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero; |
252 | }; |
253 | |
254 | template <> |
255 | class __libcpp_numeric_limits<bool, true> |
256 | { |
257 | protected: |
258 | typedef bool type; |
259 | |
260 | static _LIBCPP_CONSTEXPR const bool is_specialized = true; |
261 | |
262 | static _LIBCPP_CONSTEXPR const bool is_signed = false; |
263 | static _LIBCPP_CONSTEXPR const int digits = 1; |
264 | static _LIBCPP_CONSTEXPR const int digits10 = 0; |
265 | static _LIBCPP_CONSTEXPR const int max_digits10 = 0; |
266 | static _LIBCPP_CONSTEXPR const type __min = false; |
267 | static _LIBCPP_CONSTEXPR const type __max = true; |
268 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;} |
269 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;} |
270 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();} |
271 | |
272 | static _LIBCPP_CONSTEXPR const bool is_integer = true; |
273 | static _LIBCPP_CONSTEXPR const bool is_exact = true; |
274 | static _LIBCPP_CONSTEXPR const int radix = 2; |
275 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);} |
276 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);} |
277 | |
278 | static _LIBCPP_CONSTEXPR const int min_exponent = 0; |
279 | static _LIBCPP_CONSTEXPR const int min_exponent10 = 0; |
280 | static _LIBCPP_CONSTEXPR const int max_exponent = 0; |
281 | static _LIBCPP_CONSTEXPR const int max_exponent10 = 0; |
282 | |
283 | static _LIBCPP_CONSTEXPR const bool has_infinity = false; |
284 | static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false; |
285 | static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false; |
286 | static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent; |
287 | static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; |
288 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);} |
289 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);} |
290 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);} |
291 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);} |
292 | |
293 | static _LIBCPP_CONSTEXPR const bool is_iec559 = false; |
294 | static _LIBCPP_CONSTEXPR const bool is_bounded = true; |
295 | static _LIBCPP_CONSTEXPR const bool is_modulo = false; |
296 | |
297 | static _LIBCPP_CONSTEXPR const bool traps = false; |
298 | static _LIBCPP_CONSTEXPR const bool tinyness_before = false; |
299 | static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero; |
300 | }; |
301 | |
302 | template <> |
303 | class __libcpp_numeric_limits<float, true> |
304 | { |
305 | protected: |
306 | typedef float type; |
307 | |
308 | static _LIBCPP_CONSTEXPR const bool is_specialized = true; |
309 | |
310 | static _LIBCPP_CONSTEXPR const bool is_signed = true; |
311 | static _LIBCPP_CONSTEXPR const int digits = __FLT_MANT_DIG__; |
312 | static _LIBCPP_CONSTEXPR const int digits10 = __FLT_DIG__; |
313 | static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103l)/100000l; |
314 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __FLT_MIN__;} |
315 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __FLT_MAX__;} |
316 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();} |
317 | |
318 | static _LIBCPP_CONSTEXPR const bool is_integer = false; |
319 | static _LIBCPP_CONSTEXPR const bool is_exact = false; |
320 | static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__; |
321 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __FLT_EPSILON__;} |
322 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5F;} |
323 | |
324 | static _LIBCPP_CONSTEXPR const int min_exponent = __FLT_MIN_EXP__; |
325 | static _LIBCPP_CONSTEXPR const int min_exponent10 = __FLT_MIN_10_EXP__; |
326 | static _LIBCPP_CONSTEXPR const int max_exponent = __FLT_MAX_EXP__; |
327 | static _LIBCPP_CONSTEXPR const int max_exponent10 = __FLT_MAX_10_EXP__; |
328 | |
329 | static _LIBCPP_CONSTEXPR const bool has_infinity = true; |
330 | static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true; |
331 | static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true; |
332 | static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present; |
333 | static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; |
334 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_valf();} |
335 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanf("" );} |
336 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansf("" );} |
337 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __FLT_DENORM_MIN__;} |
338 | |
339 | static _LIBCPP_CONSTEXPR const bool is_iec559 = true; |
340 | static _LIBCPP_CONSTEXPR const bool is_bounded = true; |
341 | static _LIBCPP_CONSTEXPR const bool is_modulo = false; |
342 | |
343 | static _LIBCPP_CONSTEXPR const bool traps = false; |
344 | #if (defined(__arm__) || defined(__aarch64__)) |
345 | static _LIBCPP_CONSTEXPR const bool tinyness_before = true; |
346 | #else |
347 | static _LIBCPP_CONSTEXPR const bool tinyness_before = false; |
348 | #endif |
349 | static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest; |
350 | }; |
351 | |
352 | template <> |
353 | class __libcpp_numeric_limits<double, true> |
354 | { |
355 | protected: |
356 | typedef double type; |
357 | |
358 | static _LIBCPP_CONSTEXPR const bool is_specialized = true; |
359 | |
360 | static _LIBCPP_CONSTEXPR const bool is_signed = true; |
361 | static _LIBCPP_CONSTEXPR const int digits = __DBL_MANT_DIG__; |
362 | static _LIBCPP_CONSTEXPR const int digits10 = __DBL_DIG__; |
363 | static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103l)/100000l; |
364 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __DBL_MIN__;} |
365 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __DBL_MAX__;} |
366 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();} |
367 | |
368 | static _LIBCPP_CONSTEXPR const bool is_integer = false; |
369 | static _LIBCPP_CONSTEXPR const bool is_exact = false; |
370 | static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__; |
371 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __DBL_EPSILON__;} |
372 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;} |
373 | |
374 | static _LIBCPP_CONSTEXPR const int min_exponent = __DBL_MIN_EXP__; |
375 | static _LIBCPP_CONSTEXPR const int min_exponent10 = __DBL_MIN_10_EXP__; |
376 | static _LIBCPP_CONSTEXPR const int max_exponent = __DBL_MAX_EXP__; |
377 | static _LIBCPP_CONSTEXPR const int max_exponent10 = __DBL_MAX_10_EXP__; |
378 | |
379 | static _LIBCPP_CONSTEXPR const bool has_infinity = true; |
380 | static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true; |
381 | static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true; |
382 | static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present; |
383 | static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; |
384 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_val();} |
385 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nan("" );} |
386 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nans("" );} |
387 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __DBL_DENORM_MIN__;} |
388 | |
389 | static _LIBCPP_CONSTEXPR const bool is_iec559 = true; |
390 | static _LIBCPP_CONSTEXPR const bool is_bounded = true; |
391 | static _LIBCPP_CONSTEXPR const bool is_modulo = false; |
392 | |
393 | static _LIBCPP_CONSTEXPR const bool traps = false; |
394 | #if (defined(__arm__) || defined(__aarch64__)) |
395 | static _LIBCPP_CONSTEXPR const bool tinyness_before = true; |
396 | #else |
397 | static _LIBCPP_CONSTEXPR const bool tinyness_before = false; |
398 | #endif |
399 | static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest; |
400 | }; |
401 | |
402 | template <> |
403 | class __libcpp_numeric_limits<long double, true> |
404 | { |
405 | protected: |
406 | typedef long double type; |
407 | |
408 | static _LIBCPP_CONSTEXPR const bool is_specialized = true; |
409 | |
410 | static _LIBCPP_CONSTEXPR const bool is_signed = true; |
411 | static _LIBCPP_CONSTEXPR const int digits = __LDBL_MANT_DIG__; |
412 | static _LIBCPP_CONSTEXPR const int digits10 = __LDBL_DIG__; |
413 | static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103l)/100000l; |
414 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __LDBL_MIN__;} |
415 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __LDBL_MAX__;} |
416 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();} |
417 | |
418 | static _LIBCPP_CONSTEXPR const bool is_integer = false; |
419 | static _LIBCPP_CONSTEXPR const bool is_exact = false; |
420 | static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__; |
421 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;} |
422 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5L;} |
423 | |
424 | static _LIBCPP_CONSTEXPR const int min_exponent = __LDBL_MIN_EXP__; |
425 | static _LIBCPP_CONSTEXPR const int min_exponent10 = __LDBL_MIN_10_EXP__; |
426 | static _LIBCPP_CONSTEXPR const int max_exponent = __LDBL_MAX_EXP__; |
427 | static _LIBCPP_CONSTEXPR const int max_exponent10 = __LDBL_MAX_10_EXP__; |
428 | |
429 | static _LIBCPP_CONSTEXPR const bool has_infinity = true; |
430 | static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true; |
431 | static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true; |
432 | static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present; |
433 | static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; |
434 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_vall();} |
435 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanl("" );} |
436 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("" );} |
437 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;} |
438 | |
439 | #if (defined(__ppc__) || defined(__ppc64__)) |
440 | static _LIBCPP_CONSTEXPR const bool is_iec559 = false; |
441 | #else |
442 | static _LIBCPP_CONSTEXPR const bool is_iec559 = true; |
443 | #endif |
444 | static _LIBCPP_CONSTEXPR const bool is_bounded = true; |
445 | static _LIBCPP_CONSTEXPR const bool is_modulo = false; |
446 | |
447 | static _LIBCPP_CONSTEXPR const bool traps = false; |
448 | #if (defined(__arm__) || defined(__aarch64__)) |
449 | static _LIBCPP_CONSTEXPR const bool tinyness_before = true; |
450 | #else |
451 | static _LIBCPP_CONSTEXPR const bool tinyness_before = false; |
452 | #endif |
453 | static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest; |
454 | }; |
455 | |
456 | template <class _Tp> |
457 | class _LIBCPP_TEMPLATE_VIS numeric_limits |
458 | : private __libcpp_numeric_limits<typename remove_cv<_Tp>::type> |
459 | { |
460 | typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base; |
461 | typedef typename __base::type type; |
462 | public: |
463 | static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; |
464 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();} |
465 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();} |
466 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();} |
467 | |
468 | static _LIBCPP_CONSTEXPR const int digits = __base::digits; |
469 | static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; |
470 | static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; |
471 | static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; |
472 | static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; |
473 | static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; |
474 | static _LIBCPP_CONSTEXPR const int radix = __base::radix; |
475 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();} |
476 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();} |
477 | |
478 | static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; |
479 | static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; |
480 | static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; |
481 | static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; |
482 | |
483 | static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; |
484 | static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; |
485 | static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; |
486 | static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; |
487 | static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; |
488 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();} |
489 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} |
490 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} |
491 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();} |
492 | |
493 | static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; |
494 | static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; |
495 | static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; |
496 | |
497 | static _LIBCPP_CONSTEXPR const bool traps = __base::traps; |
498 | static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; |
499 | static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; |
500 | }; |
501 | |
502 | template <class _Tp> |
503 | _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_specialized; |
504 | template <class _Tp> |
505 | _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits; |
506 | template <class _Tp> |
507 | _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits10; |
508 | template <class _Tp> |
509 | _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_digits10; |
510 | template <class _Tp> |
511 | _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_signed; |
512 | template <class _Tp> |
513 | _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_integer; |
514 | template <class _Tp> |
515 | _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_exact; |
516 | template <class _Tp> |
517 | _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::radix; |
518 | template <class _Tp> |
519 | _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent; |
520 | template <class _Tp> |
521 | _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent10; |
522 | template <class _Tp> |
523 | _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent; |
524 | template <class _Tp> |
525 | _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent10; |
526 | template <class _Tp> |
527 | _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_infinity; |
528 | template <class _Tp> |
529 | _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_quiet_NaN; |
530 | template <class _Tp> |
531 | _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_signaling_NaN; |
532 | template <class _Tp> |
533 | _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<_Tp>::has_denorm; |
534 | template <class _Tp> |
535 | _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_denorm_loss; |
536 | template <class _Tp> |
537 | _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_iec559; |
538 | template <class _Tp> |
539 | _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_bounded; |
540 | template <class _Tp> |
541 | _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_modulo; |
542 | template <class _Tp> |
543 | _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::traps; |
544 | template <class _Tp> |
545 | _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::tinyness_before; |
546 | template <class _Tp> |
547 | _LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style; |
548 | |
549 | template <class _Tp> |
550 | class _LIBCPP_TEMPLATE_VIS numeric_limits<const _Tp> |
551 | : private numeric_limits<_Tp> |
552 | { |
553 | typedef numeric_limits<_Tp> __base; |
554 | typedef _Tp type; |
555 | public: |
556 | static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; |
557 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();} |
558 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();} |
559 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();} |
560 | |
561 | static _LIBCPP_CONSTEXPR const int digits = __base::digits; |
562 | static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; |
563 | static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; |
564 | static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; |
565 | static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; |
566 | static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; |
567 | static _LIBCPP_CONSTEXPR const int radix = __base::radix; |
568 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();} |
569 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();} |
570 | |
571 | static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; |
572 | static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; |
573 | static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; |
574 | static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; |
575 | |
576 | static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; |
577 | static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; |
578 | static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; |
579 | static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; |
580 | static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; |
581 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();} |
582 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} |
583 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} |
584 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();} |
585 | |
586 | static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; |
587 | static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; |
588 | static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; |
589 | |
590 | static _LIBCPP_CONSTEXPR const bool traps = __base::traps; |
591 | static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; |
592 | static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; |
593 | }; |
594 | |
595 | template <class _Tp> |
596 | _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_specialized; |
597 | template <class _Tp> |
598 | _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits; |
599 | template <class _Tp> |
600 | _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits10; |
601 | template <class _Tp> |
602 | _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_digits10; |
603 | template <class _Tp> |
604 | _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_signed; |
605 | template <class _Tp> |
606 | _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_integer; |
607 | template <class _Tp> |
608 | _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_exact; |
609 | template <class _Tp> |
610 | _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::radix; |
611 | template <class _Tp> |
612 | _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent; |
613 | template <class _Tp> |
614 | _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent10; |
615 | template <class _Tp> |
616 | _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent; |
617 | template <class _Tp> |
618 | _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent10; |
619 | template <class _Tp> |
620 | _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_infinity; |
621 | template <class _Tp> |
622 | _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_quiet_NaN; |
623 | template <class _Tp> |
624 | _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_signaling_NaN; |
625 | template <class _Tp> |
626 | _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const _Tp>::has_denorm; |
627 | template <class _Tp> |
628 | _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_denorm_loss; |
629 | template <class _Tp> |
630 | _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_iec559; |
631 | template <class _Tp> |
632 | _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_bounded; |
633 | template <class _Tp> |
634 | _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_modulo; |
635 | template <class _Tp> |
636 | _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::traps; |
637 | template <class _Tp> |
638 | _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::tinyness_before; |
639 | template <class _Tp> |
640 | _LIBCPP_CONSTEXPR const float_round_style numeric_limits<const _Tp>::round_style; |
641 | |
642 | template <class _Tp> |
643 | class _LIBCPP_TEMPLATE_VIS numeric_limits<volatile _Tp> |
644 | : private numeric_limits<_Tp> |
645 | { |
646 | typedef numeric_limits<_Tp> __base; |
647 | typedef _Tp type; |
648 | public: |
649 | static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; |
650 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();} |
651 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();} |
652 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();} |
653 | |
654 | static _LIBCPP_CONSTEXPR const int digits = __base::digits; |
655 | static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; |
656 | static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; |
657 | static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; |
658 | static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; |
659 | static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; |
660 | static _LIBCPP_CONSTEXPR const int radix = __base::radix; |
661 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();} |
662 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();} |
663 | |
664 | static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; |
665 | static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; |
666 | static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; |
667 | static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; |
668 | |
669 | static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; |
670 | static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; |
671 | static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; |
672 | static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; |
673 | static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; |
674 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();} |
675 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} |
676 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} |
677 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();} |
678 | |
679 | static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; |
680 | static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; |
681 | static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; |
682 | |
683 | static _LIBCPP_CONSTEXPR const bool traps = __base::traps; |
684 | static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; |
685 | static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; |
686 | }; |
687 | |
688 | template <class _Tp> |
689 | _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_specialized; |
690 | template <class _Tp> |
691 | _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits; |
692 | template <class _Tp> |
693 | _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits10; |
694 | template <class _Tp> |
695 | _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_digits10; |
696 | template <class _Tp> |
697 | _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_signed; |
698 | template <class _Tp> |
699 | _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_integer; |
700 | template <class _Tp> |
701 | _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_exact; |
702 | template <class _Tp> |
703 | _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::radix; |
704 | template <class _Tp> |
705 | _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent; |
706 | template <class _Tp> |
707 | _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent10; |
708 | template <class _Tp> |
709 | _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent; |
710 | template <class _Tp> |
711 | _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent10; |
712 | template <class _Tp> |
713 | _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_infinity; |
714 | template <class _Tp> |
715 | _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_quiet_NaN; |
716 | template <class _Tp> |
717 | _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_signaling_NaN; |
718 | template <class _Tp> |
719 | _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<volatile _Tp>::has_denorm; |
720 | template <class _Tp> |
721 | _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_denorm_loss; |
722 | template <class _Tp> |
723 | _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_iec559; |
724 | template <class _Tp> |
725 | _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_bounded; |
726 | template <class _Tp> |
727 | _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_modulo; |
728 | template <class _Tp> |
729 | _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::traps; |
730 | template <class _Tp> |
731 | _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::tinyness_before; |
732 | template <class _Tp> |
733 | _LIBCPP_CONSTEXPR const float_round_style numeric_limits<volatile _Tp>::round_style; |
734 | |
735 | template <class _Tp> |
736 | class _LIBCPP_TEMPLATE_VIS numeric_limits<const volatile _Tp> |
737 | : private numeric_limits<_Tp> |
738 | { |
739 | typedef numeric_limits<_Tp> __base; |
740 | typedef _Tp type; |
741 | public: |
742 | static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; |
743 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();} |
744 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();} |
745 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();} |
746 | |
747 | static _LIBCPP_CONSTEXPR const int digits = __base::digits; |
748 | static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; |
749 | static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; |
750 | static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; |
751 | static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; |
752 | static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; |
753 | static _LIBCPP_CONSTEXPR const int radix = __base::radix; |
754 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();} |
755 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();} |
756 | |
757 | static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; |
758 | static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; |
759 | static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; |
760 | static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; |
761 | |
762 | static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; |
763 | static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; |
764 | static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; |
765 | static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; |
766 | static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; |
767 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();} |
768 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} |
769 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} |
770 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();} |
771 | |
772 | static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; |
773 | static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; |
774 | static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; |
775 | |
776 | static _LIBCPP_CONSTEXPR const bool traps = __base::traps; |
777 | static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; |
778 | static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; |
779 | }; |
780 | |
781 | template <class _Tp> |
782 | _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_specialized; |
783 | template <class _Tp> |
784 | _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits; |
785 | template <class _Tp> |
786 | _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits10; |
787 | template <class _Tp> |
788 | _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_digits10; |
789 | template <class _Tp> |
790 | _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_signed; |
791 | template <class _Tp> |
792 | _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_integer; |
793 | template <class _Tp> |
794 | _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_exact; |
795 | template <class _Tp> |
796 | _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::radix; |
797 | template <class _Tp> |
798 | _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent; |
799 | template <class _Tp> |
800 | _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent10; |
801 | template <class _Tp> |
802 | _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent; |
803 | template <class _Tp> |
804 | _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent10; |
805 | template <class _Tp> |
806 | _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_infinity; |
807 | template <class _Tp> |
808 | _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_quiet_NaN; |
809 | template <class _Tp> |
810 | _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_signaling_NaN; |
811 | template <class _Tp> |
812 | _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const volatile _Tp>::has_denorm; |
813 | template <class _Tp> |
814 | _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_denorm_loss; |
815 | template <class _Tp> |
816 | _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_iec559; |
817 | template <class _Tp> |
818 | _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_bounded; |
819 | template <class _Tp> |
820 | _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_modulo; |
821 | template <class _Tp> |
822 | _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::traps; |
823 | template <class _Tp> |
824 | _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::tinyness_before; |
825 | template <class _Tp> |
826 | _LIBCPP_CONSTEXPR const float_round_style numeric_limits<const volatile _Tp>::round_style; |
827 | |
828 | _LIBCPP_END_NAMESPACE_STD |
829 | |
830 | _LIBCPP_POP_MACROS |
831 | |
832 | #endif // _LIBCPP_LIMITS |
833 | |