VirtualBox

source: vbox/trunk/include/iprt/nocrt/limits@ 96504

Last change on this file since 96504 was 96407, checked in by vboxsync, 3 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.3 KB
Line 
1/** @file
2 * IPRT / No-CRT - C++ limits header.
3 */
4
5/*
6 * Copyright (C) 2022 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef VBOX_INCLUDED_SRC_nocrt_limits
37#define VBOX_INCLUDED_SRC_nocrt_limits
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <iprt/nocrt/limits.h>
43
44namespace std
45{
46 enum float_denorm_style
47 {
48 denorm_indeterminate = -1,
49 denorm_absent,
50 denorm_present,
51 };
52
53 enum float_round_style
54 {
55 round_indeterminate = -1,
56 round_toward_zero,
57 round_to_nearest,
58 round_toward_infinity,
59 round_toward_neg_infinity,
60 };
61
62 struct rtNoCrtLimitNumericBase
63 {
64 static const bool is_specialized = false;
65 static const bool is_integer = false;
66 static const bool is_signed = false;
67 static const bool is_exact = false;
68 static const bool is_bounded = false;
69
70 static const bool has_infinity = false;
71 static const bool has_quiet_NaN = false;
72 static const bool has_signaling_NaN = false;
73 static const bool has_denorm_loss = false;
74 static const bool is_iec559 = false;
75 static const bool is_modulo = false;
76 static const bool traps = false;
77 static const bool tinyness_before = false;
78
79 static const int digits = 0;
80 static const int digits10 = 0;
81 static const int max_digits10 = 0;
82 static const int radix = 0;
83 static const int min_exponent = 0;
84 static const int min_exponent10 = 0;
85 static const int max_exponent = 0;
86 static const int max_exponent10 = 0;
87
88 static const float_denorm_style has_denorm = denorm_absent;
89 static const float_round_style round_style = round_toward_zero;
90 };
91
92 struct rtNoCrtLimitNumericIntBase : public rtNoCrtLimitNumericBase
93 {
94 static const bool is_specialized = true;
95 static const bool is_integer = true;
96 static const bool is_exact = true;
97 static const bool is_bounded = true;
98 static const int radix = 2;
99 };
100
101 struct rtNoCrtLimitNumericFloatBase : public rtNoCrtLimitNumericBase
102 {
103 static const bool is_specialized = true;
104 static const bool is_signed = true;
105 static const bool is_bounded = true;
106 static const bool has_infinity = false;
107 static const bool has_quiet_NaN = false;
108 static const bool has_signaling_NaN = false;
109 static const bool is_iec559 = false;
110 static const int radix = FLT_RADIX;
111 static const float_denorm_style has_denorm = denorm_present;
112 static const float_round_style round_style = round_to_nearest;
113 };
114
115 /*
116 * Generic template.
117 */
118 template<typename a_Type>
119 struct numeric_limits : public rtNoCrtLimitNumericBase
120 {
121 /** @todo need a RT_CONSTEXPR_FN etc */
122 static constexpr a_Type(min)() RT_NOEXCEPT { return a_Type(); }
123 static constexpr a_Type(max)() RT_NOEXCEPT { return a_Type(); }
124 static constexpr a_Type lowest() RT_NOEXCEPT { return a_Type(); }
125 static constexpr a_Type epsilon() RT_NOEXCEPT { return a_Type(); }
126 static constexpr a_Type round_error() RT_NOEXCEPT { return a_Type(); }
127 static constexpr a_Type infinity() RT_NOEXCEPT { return a_Type(); }
128 static constexpr a_Type quiet_NaN() RT_NOEXCEPT { return a_Type(); }
129 static constexpr a_Type signaling_NaN() RT_NOEXCEPT { return a_Type(); }
130 static constexpr a_Type denorm_min() RT_NOEXCEPT { return a_Type(); }
131 };
132
133 /* const and volatile trickery: */
134 template<typename a_Type> struct numeric_limits<const a_Type> : public numeric_limits<a_Type> {};
135 template<typename a_Type> struct numeric_limits<volatile a_Type> : public numeric_limits<a_Type> {};
136 template<typename a_Type> struct numeric_limits<const volatile a_Type> : public numeric_limits<a_Type> {};
137
138 /*
139 * Integer specializations.
140 */
141 template<>
142 struct numeric_limits<bool> : public rtNoCrtLimitNumericIntBase
143 {
144 static constexpr bool(min)() RT_NOEXCEPT { return false; }
145 static constexpr bool(max)() RT_NOEXCEPT { return true; }
146 static constexpr bool lowest() RT_NOEXCEPT { return false; }
147 static constexpr bool epsilon() RT_NOEXCEPT { return false; }
148 static constexpr bool round_error() RT_NOEXCEPT { return false; }
149 static constexpr bool infinity() RT_NOEXCEPT { return false; }
150 static constexpr bool quiet_NaN() RT_NOEXCEPT { return false; }
151 static constexpr bool signaling_NaN() RT_NOEXCEPT { return false; }
152 static constexpr bool denorm_min() RT_NOEXCEPT { return false; }
153 static const int digits = 1;
154 };
155
156 template<>
157 struct numeric_limits<char> : public rtNoCrtLimitNumericIntBase
158 {
159 static constexpr char(min)() RT_NOEXCEPT { return CHAR_MIN; }
160 static constexpr char(max)() RT_NOEXCEPT { return CHAR_MAX; }
161 static constexpr char lowest() RT_NOEXCEPT { return CHAR_MIN; }
162 static constexpr char epsilon() RT_NOEXCEPT { return 0; }
163 static constexpr char round_error() RT_NOEXCEPT { return 0; }
164 static constexpr char infinity() RT_NOEXCEPT { return 0; }
165 static constexpr char quiet_NaN() RT_NOEXCEPT { return 0; }
166 static constexpr char signaling_NaN() RT_NOEXCEPT { return 0; }
167 static constexpr char denorm_min() RT_NOEXCEPT { return 0; }
168
169 static const bool is_signed = (char)(-1) < 0;
170 static const bool is_modulo = (char)(-1) > 0;
171 static const int digits = (char)(-1) < 0 ? CHAR_BIT - 1 : CHAR_BIT;
172 static const int digits10 = 2;
173 };
174
175 template<>
176 struct numeric_limits<signed char> : public rtNoCrtLimitNumericIntBase
177 {
178 static constexpr signed char(min)() RT_NOEXCEPT { return SCHAR_MIN; }
179 static constexpr signed char(max)() RT_NOEXCEPT { return SCHAR_MAX; }
180 static constexpr signed char lowest() RT_NOEXCEPT { return SCHAR_MIN; }
181 static constexpr signed char epsilon() RT_NOEXCEPT { return 0; }
182 static constexpr signed char round_error() RT_NOEXCEPT { return 0; }
183 static constexpr signed char infinity() RT_NOEXCEPT { return 0; }
184 static constexpr signed char quiet_NaN() RT_NOEXCEPT { return 0; }
185 static constexpr signed char signaling_NaN() RT_NOEXCEPT { return 0; }
186 static constexpr signed char denorm_min() RT_NOEXCEPT { return 0; }
187
188 static const bool is_signed = true;
189 static const int digits = CHAR_BIT - 1;
190 static const int digits10 = 2;
191 };
192
193 template<>
194 struct numeric_limits<unsigned char> : public rtNoCrtLimitNumericIntBase
195 {
196 static constexpr unsigned char(min)() RT_NOEXCEPT { return 0; }
197 static constexpr unsigned char(max)() RT_NOEXCEPT { return UCHAR_MAX; }
198 static constexpr unsigned char lowest() RT_NOEXCEPT { return 0; }
199 static constexpr unsigned char epsilon() RT_NOEXCEPT { return 0; }
200 static constexpr unsigned char round_error() RT_NOEXCEPT { return 0; }
201 static constexpr unsigned char infinity() RT_NOEXCEPT { return 0; }
202 static constexpr unsigned char quiet_NaN() RT_NOEXCEPT { return 0; }
203 static constexpr unsigned char signaling_NaN() RT_NOEXCEPT { return 0; }
204 static constexpr unsigned char denorm_min() RT_NOEXCEPT { return 0; }
205
206 static const bool is_modulo = true;
207 static const int digits = CHAR_BIT;
208 static const int digits10 = 2;
209 };
210
211 /** @todo wchar_t, char8_t, char16_t, char32_t */
212
213 template<>
214 struct numeric_limits<short> : public rtNoCrtLimitNumericIntBase
215 {
216 static constexpr short(min)() RT_NOEXCEPT { return SHRT_MIN; }
217 static constexpr short(max)() RT_NOEXCEPT { return SHRT_MAX; }
218 static constexpr short lowest() RT_NOEXCEPT { return SHRT_MIN; }
219 static constexpr short epsilon() RT_NOEXCEPT { return 0; }
220 static constexpr short round_error() RT_NOEXCEPT { return 0; }
221 static constexpr short infinity() RT_NOEXCEPT { return 0; }
222 static constexpr short quiet_NaN() RT_NOEXCEPT { return 0; }
223 static constexpr short signaling_NaN() RT_NOEXCEPT { return 0; }
224 static constexpr short denorm_min() RT_NOEXCEPT { return 0; }
225
226 static const bool is_signed = true;
227 static const int digits = CHAR_BIT * sizeof(short) - 1;
228 static const int digits10 = 4;
229 };
230
231 template<>
232 struct numeric_limits<unsigned short> : public rtNoCrtLimitNumericIntBase
233 {
234 static constexpr unsigned short(min)() RT_NOEXCEPT { return 0; }
235 static constexpr unsigned short(max)() RT_NOEXCEPT { return USHRT_MAX; }
236 static constexpr unsigned short lowest() RT_NOEXCEPT { return 0; }
237 static constexpr unsigned short epsilon() RT_NOEXCEPT { return 0; }
238 static constexpr unsigned short round_error() RT_NOEXCEPT { return 0; }
239 static constexpr unsigned short infinity() RT_NOEXCEPT { return 0; }
240 static constexpr unsigned short quiet_NaN() RT_NOEXCEPT { return 0; }
241 static constexpr unsigned short signaling_NaN() RT_NOEXCEPT { return 0; }
242 static constexpr unsigned short denorm_min() RT_NOEXCEPT { return 0; }
243
244 static const bool is_modulo = true;
245 static const int digits = CHAR_BIT * sizeof(unsigned short);
246 static const int digits10 = 4;
247 };
248
249# if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
250 template<>
251 struct numeric_limits<wchar_t> : public rtNoCrtLimitNumericIntBase
252 {
253 static constexpr wchar_t(min)() RT_NOEXCEPT { return WCHAR_MIN; }
254 static constexpr wchar_t(max)() RT_NOEXCEPT { return WCHAR_MAX; }
255 static constexpr wchar_t lowest() RT_NOEXCEPT { return WCHAR_MIN; }
256 static constexpr wchar_t epsilon() RT_NOEXCEPT { return 0; }
257 static constexpr wchar_t round_error() RT_NOEXCEPT { return 0; }
258 static constexpr wchar_t infinity() RT_NOEXCEPT { return 0; }
259 static constexpr wchar_t quiet_NaN() RT_NOEXCEPT { return 0; }
260 static constexpr wchar_t signaling_NaN() RT_NOEXCEPT { return 0; }
261 static constexpr wchar_t denorm_min() RT_NOEXCEPT { return 0; }
262
263 static const bool is_modulo = true;
264 static const int digits = CHAR_BIT * sizeof(wchar_t);
265 static const int digits10 = sizeof(wchar_t) == 2 ? 4 : 9; /** @todo ASSUMES wchar_t is either 16 or 32 bits */
266 };
267# endif
268
269 template<>
270 struct numeric_limits<char16_t> : public rtNoCrtLimitNumericIntBase
271 {
272 static constexpr char16_t(min)() RT_NOEXCEPT { return 0; }
273 static constexpr char16_t(max)() RT_NOEXCEPT { return USHRT_MAX; }
274 static constexpr char16_t lowest() RT_NOEXCEPT { return 0; }
275 static constexpr char16_t epsilon() RT_NOEXCEPT { return 0; }
276 static constexpr char16_t round_error() RT_NOEXCEPT { return 0; }
277 static constexpr char16_t infinity() RT_NOEXCEPT { return 0; }
278 static constexpr char16_t quiet_NaN() RT_NOEXCEPT { return 0; }
279 static constexpr char16_t signaling_NaN() RT_NOEXCEPT { return 0; }
280 static constexpr char16_t denorm_min() RT_NOEXCEPT { return 0; }
281
282 static const bool is_modulo = true;
283 static const int digits = CHAR_BIT * sizeof(char16_t);
284 static const int digits10 = 4;
285 };
286
287 template<>
288 struct numeric_limits<int> : public rtNoCrtLimitNumericIntBase
289 {
290 static constexpr int(min)() RT_NOEXCEPT { return INT_MIN; }
291 static constexpr int(max)() RT_NOEXCEPT { return INT_MAX; }
292 static constexpr int lowest() RT_NOEXCEPT { return INT_MIN; }
293 static constexpr int epsilon() RT_NOEXCEPT { return 0; }
294 static constexpr int round_error() RT_NOEXCEPT { return 0; }
295 static constexpr int infinity() RT_NOEXCEPT { return 0; }
296 static constexpr int quiet_NaN() RT_NOEXCEPT { return 0; }
297 static constexpr int signaling_NaN() RT_NOEXCEPT { return 0; }
298 static constexpr int denorm_min() RT_NOEXCEPT { return 0; }
299
300 static const bool is_signed = true;
301 static const int digits = CHAR_BIT * sizeof(int) - 1;
302 static const int digits10 = 9;
303 };
304
305 template<>
306 struct numeric_limits<unsigned int> : public rtNoCrtLimitNumericIntBase
307 {
308 static constexpr unsigned int(min)() RT_NOEXCEPT { return 0; }
309 static constexpr unsigned int(max)() RT_NOEXCEPT { return UINT_MAX; }
310 static constexpr unsigned int lowest() RT_NOEXCEPT { return 0; }
311 static constexpr unsigned int epsilon() RT_NOEXCEPT { return 0; }
312 static constexpr unsigned int round_error() RT_NOEXCEPT { return 0; }
313 static constexpr unsigned int infinity() RT_NOEXCEPT { return 0; }
314 static constexpr unsigned int quiet_NaN() RT_NOEXCEPT { return 0; }
315 static constexpr unsigned int signaling_NaN() RT_NOEXCEPT { return 0; }
316 static constexpr unsigned int denorm_min() RT_NOEXCEPT { return 0; }
317
318 static const bool is_modulo = true;
319 static const int digits = CHAR_BIT * sizeof(unsigned int);
320 static const int digits10 = 9;
321 };
322
323 template<>
324 struct numeric_limits<char32_t> : public rtNoCrtLimitNumericIntBase
325 {
326 static constexpr char32_t(min)() RT_NOEXCEPT { return 0; }
327 static constexpr char32_t(max)() RT_NOEXCEPT { return UINT_MAX; }
328 static constexpr char32_t lowest() RT_NOEXCEPT { return 0; }
329 static constexpr char32_t epsilon() RT_NOEXCEPT { return 0; }
330 static constexpr char32_t round_error() RT_NOEXCEPT { return 0; }
331 static constexpr char32_t infinity() RT_NOEXCEPT { return 0; }
332 static constexpr char32_t quiet_NaN() RT_NOEXCEPT { return 0; }
333 static constexpr char32_t signaling_NaN() RT_NOEXCEPT { return 0; }
334 static constexpr char32_t denorm_min() RT_NOEXCEPT { return 0; }
335
336 static const bool is_modulo = true;
337 static const int digits = CHAR_BIT * sizeof(char32_t);
338 static const int digits10 = 9;
339 };
340
341 template<>
342 struct numeric_limits<long> : public rtNoCrtLimitNumericIntBase
343 {
344 static constexpr long(min)() RT_NOEXCEPT { return LONG_MIN; }
345 static constexpr long(max)() RT_NOEXCEPT { return LONG_MAX; }
346 static constexpr long lowest() RT_NOEXCEPT { return LONG_MIN; }
347 static constexpr long epsilon() RT_NOEXCEPT { return 0; }
348 static constexpr long round_error() RT_NOEXCEPT { return 0; }
349 static constexpr long infinity() RT_NOEXCEPT { return 0; }
350 static constexpr long quiet_NaN() RT_NOEXCEPT { return 0; }
351 static constexpr long signaling_NaN() RT_NOEXCEPT { return 0; }
352 static constexpr long denorm_min() RT_NOEXCEPT { return 0; }
353
354 static const bool is_signed = true;
355 static const int digits = CHAR_BIT * sizeof(long) - 1;
356 static const int digits10 = sizeof(long) == sizeof(int) ? 9 : 18;
357 };
358
359 template<>
360 struct numeric_limits<unsigned long> : public rtNoCrtLimitNumericIntBase
361 {
362 static constexpr unsigned long(min)() RT_NOEXCEPT { return 0; }
363 static constexpr unsigned long(max)() RT_NOEXCEPT { return ULONG_MAX; }
364 static constexpr unsigned long lowest() RT_NOEXCEPT { return 0; }
365 static constexpr unsigned long epsilon() RT_NOEXCEPT { return 0; }
366 static constexpr unsigned long round_error() RT_NOEXCEPT { return 0; }
367 static constexpr unsigned long infinity() RT_NOEXCEPT { return 0; }
368 static constexpr unsigned long quiet_NaN() RT_NOEXCEPT { return 0; }
369 static constexpr unsigned long signaling_NaN() RT_NOEXCEPT { return 0; }
370 static constexpr unsigned long denorm_min() RT_NOEXCEPT { return 0; }
371
372 static const bool is_modulo = true;
373 static const int digits = CHAR_BIT * sizeof(unsigned long);
374 static const int digits10 = sizeof(unsigned long) == sizeof(unsigned int) ? 9 : 19;
375 };
376
377 template<>
378 struct numeric_limits<long long> : public rtNoCrtLimitNumericIntBase
379 {
380 static constexpr long long(min)() RT_NOEXCEPT { return LLONG_MIN; }
381 static constexpr long long(max)() RT_NOEXCEPT { return LLONG_MAX; }
382 static constexpr long long lowest() RT_NOEXCEPT { return LLONG_MIN; }
383 static constexpr long long epsilon() RT_NOEXCEPT { return 0; }
384 static constexpr long long round_error() RT_NOEXCEPT { return 0; }
385 static constexpr long long infinity() RT_NOEXCEPT { return 0; }
386 static constexpr long long quiet_NaN() RT_NOEXCEPT { return 0; }
387 static constexpr long long signaling_NaN() RT_NOEXCEPT { return 0; }
388 static constexpr long long denorm_min() RT_NOEXCEPT { return 0; }
389
390 static const bool is_signed = true;
391 static const int digits = CHAR_BIT * sizeof(long long) - 1;
392 static const int digits10 = 18;
393 };
394
395 template<>
396 struct numeric_limits<unsigned long long> : public rtNoCrtLimitNumericIntBase
397 {
398 static constexpr unsigned long long(min)() RT_NOEXCEPT { return 0; }
399 static constexpr unsigned long long(max)() RT_NOEXCEPT { return ULLONG_MAX; }
400 static constexpr unsigned long long lowest() RT_NOEXCEPT { return 0; }
401 static constexpr unsigned long long epsilon() RT_NOEXCEPT { return 0; }
402 static constexpr unsigned long long round_error() RT_NOEXCEPT { return 0; }
403 static constexpr unsigned long long infinity() RT_NOEXCEPT { return 0; }
404 static constexpr unsigned long long quiet_NaN() RT_NOEXCEPT { return 0; }
405 static constexpr unsigned long long signaling_NaN() RT_NOEXCEPT { return 0; }
406 static constexpr unsigned long long denorm_min() RT_NOEXCEPT { return 0; }
407
408 static const bool is_modulo = true;
409 static const int digits = CHAR_BIT * sizeof(unsigned long long);
410 static const int digits10 = 19;
411 };
412
413
414 /*
415 * Floating point.
416 */
417 template<>
418 struct numeric_limits<float> : public rtNoCrtLimitNumericFloatBase
419 {
420 static constexpr float(min)() RT_NOEXCEPT { return FLT_MIN; }
421 static constexpr float(max)() RT_NOEXCEPT { return FLT_MAX; }
422 static constexpr float lowest() RT_NOEXCEPT { return -(FLT_MAX); }
423 static constexpr float epsilon() RT_NOEXCEPT { return FLT_EPSILON; }
424 static constexpr float round_error() RT_NOEXCEPT { return 0.5F; }
425 static constexpr float infinity() RT_NOEXCEPT { return __builtin_huge_valf(); }
426 static constexpr float quiet_NaN() RT_NOEXCEPT { return __builtin_nanf("0"); }
427 static constexpr float signaling_NaN() RT_NOEXCEPT { return __builtin_nansf("1"); }
428 static constexpr float denorm_min() RT_NOEXCEPT { return FLT_TRUE_MIN; }
429
430 static const int digits = FLT_MANT_DIG;
431 static const int digits10 = FLT_DIG;
432 static const int max_digits10 = FLT_DECIMAL_DIG;
433 static const int max_exponent = FLT_MAX_EXP;
434 static const int max_exponent10 = FLT_MAX_10_EXP;
435 static const int min_exponent = FLT_MIN_EXP;
436 static const int min_exponent10 = FLT_MIN_10_EXP;
437 };
438
439 template<>
440 struct numeric_limits<double> : public rtNoCrtLimitNumericFloatBase
441 {
442 static constexpr double(min)() RT_NOEXCEPT { return DBL_MIN; }
443 static constexpr double(max)() RT_NOEXCEPT { return DBL_MAX; }
444 static constexpr double lowest() RT_NOEXCEPT { return -(DBL_MAX); }
445 static constexpr double epsilon() RT_NOEXCEPT { return DBL_EPSILON; }
446 static constexpr double round_error() RT_NOEXCEPT { return 0.5; }
447 static constexpr double infinity() RT_NOEXCEPT { return __builtin_huge_val(); }
448 static constexpr double quiet_NaN() RT_NOEXCEPT { return __builtin_nan("0"); }
449 static constexpr double signaling_NaN() RT_NOEXCEPT { return __builtin_nans("1"); }
450 static constexpr double denorm_min() RT_NOEXCEPT { return DBL_TRUE_MIN; }
451
452 static const int digits = DBL_MANT_DIG;
453 static const int digits10 = DBL_DIG;
454 static const int max_digits10 = DBL_DECIMAL_DIG;
455 static const int max_exponent = DBL_MAX_EXP;
456 static const int max_exponent10 = DBL_MAX_10_EXP;
457 static const int min_exponent = DBL_MIN_EXP;
458 static const int min_exponent10 = DBL_MIN_10_EXP;
459 };
460
461 template<>
462 struct numeric_limits<long double> : public rtNoCrtLimitNumericFloatBase
463 {
464 static constexpr long double(min)() RT_NOEXCEPT { return LDBL_MIN; }
465 static constexpr long double(max)() RT_NOEXCEPT { return LDBL_MAX; }
466 static constexpr long double lowest() RT_NOEXCEPT { return -(LDBL_MAX); }
467 static constexpr long double epsilon() RT_NOEXCEPT { return LDBL_EPSILON; }
468 static constexpr long double round_error() RT_NOEXCEPT { return 0.5L; }
469#if LDBL_DIG == DBL_DIG
470 static constexpr long double infinity() RT_NOEXCEPT { return __builtin_huge_val(); }
471 static constexpr long double quiet_NaN() RT_NOEXCEPT { return __builtin_nan("0"); }
472 static constexpr long double signaling_NaN() RT_NOEXCEPT { return __builtin_nans("1"); }
473#else
474 static constexpr long double infinity() RT_NOEXCEPT { return __builtin_huge_vall(); }
475 static constexpr long double quiet_NaN() RT_NOEXCEPT { return __builtin_nanl("0"); }
476 static constexpr long double signaling_NaN() RT_NOEXCEPT { return __builtin_nansl("1"); }
477#endif
478 static constexpr long double denorm_min() RT_NOEXCEPT { return LDBL_TRUE_MIN; }
479
480 static const int digits = LDBL_MANT_DIG;
481 static const int digits10 = LDBL_DIG;
482 static const int max_digits10 = LDBL_DECIMAL_DIG;
483 static const int max_exponent = LDBL_MAX_EXP;
484 static const int max_exponent10 = LDBL_MAX_10_EXP;
485 static const int min_exponent = LDBL_MIN_EXP;
486 static const int min_exponent10 = LDBL_MIN_10_EXP;
487 };
488
489 /** @todo more types */
490}
491
492#endif /* !VBOX_INCLUDED_SRC_nocrt_limits */
493
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette