]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/include/std/std_limits.h
reload1.c (reload_cse_move2add): Use STRICT_LOW_PART if PLUS does not reduce the...
[thirdparty/gcc.git] / libstdc++-v3 / include / std / std_limits.h
CommitLineData
54c1bf78 1// The template and inlines for the -*- C++ -*- numeric_limits classes.
de96ac46 2
14d22dd6 3// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
de96ac46
BK
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 2, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License along
17// with this library; see the file COPYING. If not, write to the Free
18// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19// USA.
20
21// As a special exception, you may use this file as part of a free software
22// library without restriction. Specifically, if other files instantiate
23// templates or use macros or inline functions from this file, or you compile
24// this file and link it with other files to produce an executable, this
25// file does not by itself cause the resulting executable to be covered by
26// the GNU General Public License. This exception does not however
27// invalidate any other reasons why the executable file might be covered by
28// the GNU General Public License.
29
54c1bf78
BK
30// Note: this is not a conforming implementation.
31// Written by Gabriel Dos Reis <gdr@codesourcery.com>
32
33//
34// ISO 14882:1998
35// 18.2.1
36//
37
ffe94f83
PE
38/** @file limits
39 * This is a Standard C++ Library header. You should @c #include this header
40 * in your programs, rather than any of the "st[dl]_*.h" implementation files.
2f9d51b8
PE
41 */
42
54c1bf78
BK
43#ifndef _CPP_NUMERIC_LIMITS
44#define _CPP_NUMERIC_LIMITS 1
45
46#pragma GCC system_header
47
54c1bf78
BK
48#include <bits/c++config.h>
49
50//
51// The numeric_limits<> traits document implementation-defined aspects
52// of fundamental arithmetic data types (integers and floating points).
53// From Standard C++ point of view, there are 13 such types:
54// * integers
55// bool (1)
56// char, signed char, unsigned char (3)
57// short, unsigned short (2)
58// int, unsigned (2)
59// long, unsigned long (2)
60//
61// * floating points
62// float (1)
63// double (1)
64// long double (1)
65//
6ad8f949 66// GNU C++ undertstands (where supported by the host C-library)
54c1bf78
BK
67// * integer
68// long long, unsigned long long (2)
69//
70// which brings us to 15 fundamental arithmetic data types in GNU C++.
71//
6ad8f949 72//
54c1bf78
BK
73// Since a numeric_limits<> is a bit tricky to get right, we rely on
74// an interface composed of macros which should be defined in config/os
75// or config/cpu when they differ from the generic (read arbitrary)
76// definitions given here.
77//
78
585e661a
GDR
79// These values can be overridden in the target configuration file.
80// The default values are appropriate for many 32-bit targets.
54c1bf78 81
da28539c
RH
82// GCC only intrinsicly supports modulo integral types. The only remaining
83// integral exceptional values is division by zero. Only targets that do not
84// signal division by zero in some "hard to ignore" way should use false.
85#ifndef __glibcpp_integral_traps
86# define __glibcpp_integral_traps true
54c1bf78
BK
87#endif
88
54c1bf78
BK
89// float
90//
91
2559486f 92// Default values. Should be overriden in configuration files if necessary.
54c1bf78 93
54c1bf78 94#ifndef __glibcpp_float_has_denorm_loss
f3cd98c4 95# define __glibcpp_float_has_denorm_loss false
54c1bf78 96#endif
54c1bf78 97#ifndef __glibcpp_float_traps
f3cd98c4 98# define __glibcpp_float_traps false
54c1bf78 99#endif
54c1bf78 100#ifndef __glibcpp_float_tinyness_before
f3cd98c4 101# define __glibcpp_float_tinyness_before false
54c1bf78
BK
102#endif
103
54c1bf78
BK
104// double
105
2559486f 106// Default values. Should be overriden in configuration files if necessary.
54c1bf78 107
54c1bf78 108#ifndef __glibcpp_double_has_denorm_loss
f3cd98c4 109# define __glibcpp_double_has_denorm_loss false
54c1bf78 110#endif
54c1bf78 111#ifndef __glibcpp_double_traps
f3cd98c4 112# define __glibcpp_double_traps false
54c1bf78 113#endif
54c1bf78 114#ifndef __glibcpp_double_tinyness_before
f3cd98c4 115# define __glibcpp_double_tinyness_before false
54c1bf78
BK
116#endif
117
54c1bf78
BK
118// long double
119
2559486f 120// Default values. Should be overriden in configuration files if necessary.
54c1bf78 121
54c1bf78 122#ifndef __glibcpp_long_double_has_denorm_loss
f3cd98c4 123# define __glibcpp_long_double_has_denorm_loss false
54c1bf78 124#endif
54c1bf78 125#ifndef __glibcpp_long_double_traps
f3cd98c4 126# define __glibcpp_long_double_traps false
54c1bf78 127#endif
54c1bf78 128#ifndef __glibcpp_long_double_tinyness_before
f3cd98c4 129# define __glibcpp_long_double_tinyness_before false
725dc051 130#endif
54c1bf78 131
6ad8f949
RH
132// You should not need to define any macros below this point.
133
134#define __glibcpp_signed(T) ((T)(-1) < 0)
135
136#define __glibcpp_min(T) \
137 (__glibcpp_signed (T) ? (T)1 << __glibcpp_digits (T) : (T)0)
138
139#define __glibcpp_max(T) \
140 (__glibcpp_signed (T) ? ((T)1 << __glibcpp_digits (T)) - 1 : ~(T)0)
141
142#define __glibcpp_digits(T) \
143 (sizeof(T) * __CHAR_BIT__ - __glibcpp_signed (T))
144
145// The fraction 643/2136 approximates log10(2) to 7 significant digits.
146#define __glibcpp_digits10(T) \
147 (__glibcpp_digits (T) * 643 / 2136)
148
54c1bf78
BK
149
150namespace std
151{
6ad8f949 152 enum float_round_style
54c1bf78
BK
153 {
154 round_indeterminate = -1,
155 round_toward_zero = 0,
156 round_to_nearest = 1,
157 round_toward_infinity = 2,
158 round_toward_neg_infinity = 3
159 };
160
6ad8f949 161 enum float_denorm_style
54c1bf78
BK
162 {
163 denorm_indeterminate = -1,
164 denorm_absent = 0,
165 denorm_present = 1
166 };
167
168 //
169 // The primary class traits
170 //
84979344
BK
171 struct __numeric_limits_base
172 {
173 static const bool is_specialized = false;
174
175 static const int digits = 0;
176 static const int digits10 = 0;
177 static const bool is_signed = false;
178 static const bool is_integer = false;
179 static const bool is_exact = false;
180 static const int radix = 0;
181
182 static const int min_exponent = 0;
183 static const int min_exponent10 = 0;
184 static const int max_exponent = 0;
185 static const int max_exponent10 = 0;
6ad8f949 186
84979344
BK
187 static const bool has_infinity = false;
188 static const bool has_quiet_NaN = false;
189 static const bool has_signaling_NaN = false;
190 static const float_denorm_style has_denorm = denorm_absent;
191 static const bool has_denorm_loss = false;
192
193 static const bool is_iec559 = false;
194 static const bool is_bounded = false;
195 static const bool is_modulo = false;
196
197 static const bool traps = false;
198 static const bool tinyness_before = false;
199 static const float_round_style round_style = round_toward_zero;
200 };
201
6ad8f949
RH
202 template<typename _Tp>
203 struct numeric_limits : public __numeric_limits_base
54c1bf78 204 {
54c1bf78
BK
205 static _Tp min() throw() { return static_cast<_Tp>(0); }
206 static _Tp max() throw() { return static_cast<_Tp>(0); }
54c1bf78
BK
207 static _Tp epsilon() throw() { return static_cast<_Tp>(0); }
208 static _Tp round_error() throw() { return static_cast<_Tp>(0); }
54c1bf78
BK
209 static _Tp infinity() throw() { return static_cast<_Tp>(0); }
210 static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }
211 static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }
212 static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }
54c1bf78
BK
213 };
214
54c1bf78 215 // Now there follow 15 explicit specializations. Yes, 15. Make sure
6ad8f949 216 // you get the count right.
54c1bf78
BK
217 template<>
218 struct numeric_limits<bool>
219 {
220 static const bool is_specialized = true;
221
222 static bool min() throw()
223 { return false; }
54c1bf78
BK
224 static bool max() throw()
225 { return true; }
226
6ad8f949 227 static const int digits = 1;
54c1bf78
BK
228 static const int digits10 = 0;
229 static const bool is_signed = false;
230 static const bool is_integer = true;
231 static const bool is_exact = true;
232 static const int radix = 2;
233 static bool epsilon() throw()
234 { return false; }
235 static bool round_error() throw()
236 { return false; }
237
238 static const int min_exponent = 0;
239 static const int min_exponent10 = 0;
240 static const int max_exponent = 0;
241 static const int max_exponent10 = 0;
242
243 static const bool has_infinity = false;
244 static const bool has_quiet_NaN = false;
245 static const bool has_signaling_NaN = false;
246 static const float_denorm_style has_denorm = denorm_absent;
247 static const bool has_denorm_loss = false;
248
249 static bool infinity() throw()
250 { return false; }
251 static bool quiet_NaN() throw()
252 { return false; }
253 static bool signaling_NaN() throw()
254 { return false; }
255 static bool denorm_min() throw()
256 { return false; }
257
a9bb75a7 258 static const bool is_iec559 = false;
54c1bf78 259 static const bool is_bounded = true;
a9bb75a7 260 static const bool is_modulo = false;
54c1bf78
BK
261
262 // It is not clear what it means for a boolean type to trap.
263 // This is a DR on the LWG issue list. Here, I use integer
264 // promotion semantics.
da28539c 265 static const bool traps = __glibcpp_integral_traps;
54c1bf78
BK
266 static const bool tinyness_before = false;
267 static const float_round_style round_style = round_toward_zero;
268 };
269
54c1bf78
BK
270 template<>
271 struct numeric_limits<char>
272 {
273 static const bool is_specialized = true;
274
275 static char min() throw()
6ad8f949 276 { return __glibcpp_min(char); }
54c1bf78 277 static char max() throw()
6ad8f949 278 { return __glibcpp_max(char); }
54c1bf78 279
6ad8f949
RH
280 static const int digits = __glibcpp_digits (char);
281 static const int digits10 = __glibcpp_digits10 (char);
282 static const bool is_signed = __glibcpp_signed (char);
54c1bf78
BK
283 static const bool is_integer = true;
284 static const bool is_exact = true;
285 static const int radix = 2;
286 static char epsilon() throw()
be71ea9d 287 { return 0; }
54c1bf78 288 static char round_error() throw()
be71ea9d 289 { return 0; }
54c1bf78
BK
290
291 static const int min_exponent = 0;
292 static const int min_exponent10 = 0;
293 static const int max_exponent = 0;
294 static const int max_exponent10 = 0;
295
296 static const bool has_infinity = false;
297 static const bool has_quiet_NaN = false;
298 static const bool has_signaling_NaN = false;
299 static const float_denorm_style has_denorm = denorm_absent;
300 static const bool has_denorm_loss = false;
301
302 static char infinity() throw()
303 { return char(); }
304 static char quiet_NaN() throw()
305 { return char(); }
306 static char signaling_NaN() throw()
307 { return char(); }
308 static char denorm_min() throw()
309 { return static_cast<char>(0); }
310
311 static const bool is_iec559 = false;
312 static const bool is_bounded = true;
da28539c 313 static const bool is_modulo = true;
54c1bf78 314
da28539c 315 static const bool traps = __glibcpp_integral_traps;
54c1bf78
BK
316 static const bool tinyness_before = false;
317 static const float_round_style round_style = round_toward_zero;
318 };
319
54c1bf78
BK
320 template<>
321 struct numeric_limits<signed char>
322 {
323 static const bool is_specialized = true;
324
325 static signed char min() throw()
6ad8f949 326 { return -__SCHAR_MAX__ - 1; }
54c1bf78 327 static signed char max() throw()
6ad8f949 328 { return __SCHAR_MAX__; }
54c1bf78 329
6ad8f949
RH
330 static const int digits = __glibcpp_digits (signed char);
331 static const int digits10 = __glibcpp_digits10 (signed char);
54c1bf78
BK
332 static const bool is_signed = true;
333 static const bool is_integer = true;
334 static const bool is_exact = true;
335 static const int radix = 2;
336 static signed char epsilon() throw()
337 { return 0; }
338 static signed char round_error() throw()
339 { return 0; }
340
341 static const int min_exponent = 0;
342 static const int min_exponent10 = 0;
343 static const int max_exponent = 0;
344 static const int max_exponent10 = 0;
345
346 static const bool has_infinity = false;
347 static const bool has_quiet_NaN = false;
348 static const bool has_signaling_NaN = false;
349 static const float_denorm_style has_denorm = denorm_absent;
350 static const bool has_denorm_loss = false;
351
352 static signed char infinity() throw()
353 { return static_cast<signed char>(0); }
354 static signed char quiet_NaN() throw()
355 { return static_cast<signed char>(0); }
356 static signed char signaling_NaN() throw()
357 { return static_cast<signed char>(0); }
358 static signed char denorm_min() throw()
359 { return static_cast<signed char>(0); }
360
361 static const bool is_iec559 = false;
362 static const bool is_bounded = true;
da28539c 363 static const bool is_modulo = true;
54c1bf78 364
da28539c 365 static const bool traps = __glibcpp_integral_traps;
54c1bf78
BK
366 static const bool tinyness_before = false;
367 static const float_round_style round_style = round_toward_zero;
368 };
369
54c1bf78
BK
370 template<>
371 struct numeric_limits<unsigned char>
372 {
373 static const bool is_specialized = true;
374
375 static unsigned char min() throw()
376 { return 0; }
377 static unsigned char max() throw()
6ad8f949 378 { return __SCHAR_MAX__ * 2U + 1; }
54c1bf78 379
0b4c7d80 380 static const int digits = __glibcpp_digits (unsigned char);
6ad8f949 381 static const int digits10 = __glibcpp_digits10 (unsigned char);
54c1bf78
BK
382 static const bool is_signed = false;
383 static const bool is_integer = true;
384 static const bool is_exact = true;
385 static const int radix = 2;
386 static unsigned char epsilon() throw()
387 { return 0; }
388 static unsigned char round_error() throw()
389 { return 0; }
390
391 static const int min_exponent = 0;
392 static const int min_exponent10 = 0;
393 static const int max_exponent = 0;
394 static const int max_exponent10 = 0;
395
396 static const bool has_infinity = false;
397 static const bool has_quiet_NaN = false;
398 static const bool has_signaling_NaN = false;
399 static const float_denorm_style has_denorm = denorm_absent;
400 static const bool has_denorm_loss = false;
401
402 static unsigned char infinity() throw()
403 { return static_cast<unsigned char>(0); }
404 static unsigned char quiet_NaN() throw()
405 { return static_cast<unsigned char>(0); }
406 static unsigned char signaling_NaN() throw()
407 { return static_cast<unsigned char>(0); }
408 static unsigned char denorm_min() throw()
409 { return static_cast<unsigned char>(0); }
410
411 static const bool is_iec559 = false;
412 static const bool is_bounded = true;
413 static const bool is_modulo = true;
414
da28539c 415 static const bool traps = __glibcpp_integral_traps;
54c1bf78
BK
416 static const bool tinyness_before = false;
417 static const float_round_style round_style = round_toward_zero;
418 };
419
54c1bf78
BK
420 template<>
421 struct numeric_limits<wchar_t>
422 {
423 static const bool is_specialized = true;
424
425 static wchar_t min() throw()
6ad8f949 426 { return __glibcpp_min (wchar_t); }
54c1bf78 427 static wchar_t max() throw()
6ad8f949 428 { return __glibcpp_max (wchar_t); }
54c1bf78 429
6ad8f949
RH
430 static const int digits = __glibcpp_digits (wchar_t);
431 static const int digits10 = __glibcpp_digits10 (wchar_t);
432 static const bool is_signed = __glibcpp_signed (wchar_t);
54c1bf78
BK
433 static const bool is_integer = true;
434 static const bool is_exact = true;
435 static const int radix = 2;
436 static wchar_t epsilon() throw()
437 { return 0; }
438 static wchar_t round_error() throw()
439 { return 0; }
440
441 static const int min_exponent = 0;
442 static const int min_exponent10 = 0;
443 static const int max_exponent = 0;
444 static const int max_exponent10 = 0;
445
446 static const bool has_infinity = false;
447 static const bool has_quiet_NaN = false;
448 static const bool has_signaling_NaN = false;
449 static const float_denorm_style has_denorm = denorm_absent;
450 static const bool has_denorm_loss = false;
451
452 static wchar_t infinity() throw()
453 { return wchar_t(); }
454 static wchar_t quiet_NaN() throw()
455 { return wchar_t(); }
456 static wchar_t signaling_NaN() throw()
457 { return wchar_t(); }
458 static wchar_t denorm_min() throw()
459 { return wchar_t(); }
460
461 static const bool is_iec559 = false;
462 static const bool is_bounded = true;
da28539c 463 static const bool is_modulo = true;
54c1bf78 464
da28539c 465 static const bool traps = __glibcpp_integral_traps;
54c1bf78
BK
466 static const bool tinyness_before = false;
467 static const float_round_style round_style = round_toward_zero;
468 };
469
54c1bf78
BK
470 template<>
471 struct numeric_limits<short>
472 {
473 static const bool is_specialized = true;
474
475 static short min() throw()
6ad8f949 476 { return -__SHRT_MAX__ - 1; }
54c1bf78 477 static short max() throw()
6ad8f949 478 { return __SHRT_MAX__; }
54c1bf78 479
6ad8f949
RH
480 static const int digits = __glibcpp_digits (short);
481 static const int digits10 = __glibcpp_digits10 (short);
54c1bf78
BK
482 static const bool is_signed = true;
483 static const bool is_integer = true;
484 static const bool is_exact = true;
485 static const int radix = 2;
486 static short epsilon() throw()
487 { return 0; }
488 static short round_error() throw()
489 { return 0; }
490
491 static const int min_exponent = 0;
492 static const int min_exponent10 = 0;
493 static const int max_exponent = 0;
494 static const int max_exponent10 = 0;
495
496 static const bool has_infinity = false;
497 static const bool has_quiet_NaN = false;
498 static const bool has_signaling_NaN = false;
499 static const float_denorm_style has_denorm = denorm_absent;
500 static const bool has_denorm_loss = false;
501
502 static short infinity() throw()
503 { return short(); }
504 static short quiet_NaN() throw()
505 { return short(); }
506 static short signaling_NaN() throw()
507 { return short(); }
508 static short denorm_min() throw()
509 { return short(); }
510
77bd447b 511 static const bool is_iec559 = false;
54c1bf78 512 static const bool is_bounded = true;
da28539c 513 static const bool is_modulo = true;
54c1bf78 514
da28539c 515 static const bool traps = __glibcpp_integral_traps;
54c1bf78
BK
516 static const bool tinyness_before = false;
517 static const float_round_style round_style = round_toward_zero;
518 };
519
54c1bf78
BK
520 template<>
521 struct numeric_limits<unsigned short>
522 {
523 static const bool is_specialized = true;
524
525 static unsigned short min() throw()
526 { return 0; }
527 static unsigned short max() throw()
6ad8f949 528 { return __SHRT_MAX__ * 2U + 1; }
54c1bf78 529
6ad8f949
RH
530 static const int digits = __glibcpp_digits (unsigned short);
531 static const int digits10 = __glibcpp_digits10 (unsigned short);
54c1bf78
BK
532 static const bool is_signed = false;
533 static const bool is_integer = true;
534 static const bool is_exact = true;
535 static const int radix = 2;
536 static unsigned short epsilon() throw()
537 { return 0; }
538 static unsigned short round_error() throw()
539 { return 0; }
540
541 static const int min_exponent = 0;
542 static const int min_exponent10 = 0;
543 static const int max_exponent = 0;
544 static const int max_exponent10 = 0;
545
546 static const bool has_infinity = false;
547 static const bool has_quiet_NaN = false;
548 static const bool has_signaling_NaN = false;
549 static const float_denorm_style has_denorm = denorm_absent;
550 static const bool has_denorm_loss = false;
551
552 static unsigned short infinity() throw()
553 { return static_cast<unsigned short>(0); }
554 static unsigned short quiet_NaN() throw()
555 { return static_cast<unsigned short>(0); }
556 static unsigned short signaling_NaN() throw()
557 { return static_cast<unsigned short>(0); }
558 static unsigned short denorm_min() throw()
559 { return static_cast<unsigned short>(0); }
560
77bd447b 561 static const bool is_iec559 = false;
54c1bf78
BK
562 static const bool is_bounded = true;
563 static const bool is_modulo = true;
564
da28539c 565 static const bool traps = __glibcpp_integral_traps;
54c1bf78
BK
566 static const bool tinyness_before = false;
567 static const float_round_style round_style = round_toward_zero;
568 };
569
54c1bf78
BK
570 template<>
571 struct numeric_limits<int>
572 {
573 static const bool is_specialized = true;
574
575 static int min() throw()
6ad8f949 576 { return -__INT_MAX__ - 1; }
54c1bf78 577 static int max() throw()
6ad8f949 578 { return __INT_MAX__; }
54c1bf78 579
6ad8f949
RH
580 static const int digits = __glibcpp_digits (int);
581 static const int digits10 = __glibcpp_digits10 (int);
54c1bf78
BK
582 static const bool is_signed = true;
583 static const bool is_integer = true;
584 static const bool is_exact = true;
585 static const int radix = 2;
586 static int epsilon() throw()
587 { return 0; }
588 static int round_error() throw()
589 { return 0; }
590
591 static const int min_exponent = 0;
592 static const int min_exponent10 = 0;
593 static const int max_exponent = 0;
594 static const int max_exponent10 = 0;
595
596 static const bool has_infinity = false;
597 static const bool has_quiet_NaN = false;
598 static const bool has_signaling_NaN = false;
599 static const float_denorm_style has_denorm = denorm_absent;
600 static const bool has_denorm_loss = false;
601
602 static int infinity() throw()
603 { return static_cast<int>(0); }
604 static int quiet_NaN() throw()
605 { return static_cast<int>(0); }
606 static int signaling_NaN() throw()
607 { return static_cast<int>(0); }
608 static int denorm_min() throw()
609 { return static_cast<int>(0); }
610
77bd447b 611 static const bool is_iec559 = false;
54c1bf78 612 static const bool is_bounded = true;
da28539c 613 static const bool is_modulo = true;
54c1bf78 614
da28539c 615 static const bool traps = __glibcpp_integral_traps;
54c1bf78
BK
616 static const bool tinyness_before = false;
617 static const float_round_style round_style = round_toward_zero;
618 };
619
54c1bf78
BK
620 template<>
621 struct numeric_limits<unsigned int>
622 {
623 static const bool is_specialized = true;
624
625 static unsigned int min() throw()
626 { return 0; }
6ad8f949
RH
627 static unsigned int max() throw()
628 { return __INT_MAX__ * 2U + 1; }
54c1bf78 629
6ad8f949
RH
630 static const int digits = __glibcpp_digits (unsigned int);
631 static const int digits10 = __glibcpp_digits10 (unsigned int);
54c1bf78
BK
632 static const bool is_signed = false;
633 static const bool is_integer = true;
634 static const bool is_exact = true;
635 static const int radix = 2;
636 static unsigned int epsilon() throw()
637 { return 0; }
638 static unsigned int round_error() throw()
639 { return 0; }
640
641 static const int min_exponent = 0;
642 static const int min_exponent10 = 0;
643 static const int max_exponent = 0;
644 static const int max_exponent10 = 0;
645
646 static const bool has_infinity = false;
647 static const bool has_quiet_NaN = false;
648 static const bool has_signaling_NaN = false;
649 static const float_denorm_style has_denorm = denorm_absent;
650 static const bool has_denorm_loss = false;
651
652 static unsigned int infinity() throw()
653 { return static_cast<unsigned int>(0); }
654 static unsigned int quiet_NaN() throw()
655 { return static_cast<unsigned int>(0); }
656 static unsigned int signaling_NaN() throw()
657 { return static_cast<unsigned int>(0); }
658 static unsigned int denorm_min() throw()
659 { return static_cast<unsigned int>(0); }
660
77bd447b 661 static const bool is_iec559 = false;
54c1bf78
BK
662 static const bool is_bounded = true;
663 static const bool is_modulo = true;
664
da28539c 665 static const bool traps = __glibcpp_integral_traps;
54c1bf78
BK
666 static const bool tinyness_before = false;
667 static const float_round_style round_style = round_toward_zero;
668 };
669
54c1bf78
BK
670 template<>
671 struct numeric_limits<long>
672 {
673 static const bool is_specialized = true;
674
675 static long min() throw()
6ad8f949 676 { return -__LONG_MAX__ - 1; }
54c1bf78 677 static long max() throw()
6ad8f949 678 { return __LONG_MAX__; }
54c1bf78 679
6ad8f949
RH
680 static const int digits = __glibcpp_digits (long);
681 static const int digits10 = __glibcpp_digits10 (long);
54c1bf78
BK
682 static const bool is_signed = true;
683 static const bool is_integer = true;
684 static const bool is_exact = true;
685 static const int radix = 2;
686 static long epsilon() throw()
687 { return 0; }
688 static long round_error() throw()
689 { return 0; }
690
691 static const int min_exponent = 0;
692 static const int min_exponent10 = 0;
693 static const int max_exponent = 0;
694 static const int max_exponent10 = 0;
695
696 static const bool has_infinity = false;
697 static const bool has_quiet_NaN = false;
698 static const bool has_signaling_NaN = false;
699 static const float_denorm_style has_denorm = denorm_absent;
700 static const bool has_denorm_loss = false;
701
702 static long infinity() throw()
703 { return static_cast<long>(0); }
704 static long quiet_NaN() throw()
705 { return static_cast<long>(0); }
706 static long signaling_NaN() throw()
707 { return static_cast<long>(0); }
708 static long denorm_min() throw()
709 { return static_cast<long>(0); }
710
77bd447b 711 static const bool is_iec559 = false;
54c1bf78 712 static const bool is_bounded = true;
da28539c 713 static const bool is_modulo = true;
54c1bf78 714
da28539c 715 static const bool traps = __glibcpp_integral_traps;
54c1bf78
BK
716 static const bool tinyness_before = false;
717 static const float_round_style round_style = round_toward_zero;
718 };
719
54c1bf78
BK
720 template<>
721 struct numeric_limits<unsigned long>
722 {
723 static const bool is_specialized = true;
724
725 static unsigned long min() throw()
726 { return 0; }
727 static unsigned long max() throw()
6ad8f949 728 { return __LONG_MAX__ * 2UL + 1; }
54c1bf78 729
6ad8f949
RH
730 static const int digits = __glibcpp_digits (unsigned long);
731 static const int digits10 = __glibcpp_digits10 (unsigned long);
54c1bf78
BK
732 static const bool is_signed = false;
733 static const bool is_integer = true;
734 static const bool is_exact = true;
735 static const int radix = 2;
736 static unsigned long epsilon() throw()
737 { return 0; }
738 static unsigned long round_error() throw()
739 { return 0; }
740
741 static const int min_exponent = 0;
742 static const int min_exponent10 = 0;
743 static const int max_exponent = 0;
744 static const int max_exponent10 = 0;
745
746 static const bool has_infinity = false;
747 static const bool has_quiet_NaN = false;
748 static const bool has_signaling_NaN = false;
749 static const float_denorm_style has_denorm = denorm_absent;
750 static const bool has_denorm_loss = false;
751
752 static unsigned long infinity() throw()
753 { return static_cast<unsigned long>(0); }
754 static unsigned long quiet_NaN() throw()
755 { return static_cast<unsigned long>(0); }
756 static unsigned long signaling_NaN() throw()
757 { return static_cast<unsigned long>(0); }
758 static unsigned long denorm_min() throw()
759 { return static_cast<unsigned long>(0); }
760
77bd447b 761 static const bool is_iec559 = false;
54c1bf78
BK
762 static const bool is_bounded = true;
763 static const bool is_modulo = true;
764
da28539c 765 static const bool traps = __glibcpp_integral_traps;
54c1bf78
BK
766 static const bool tinyness_before = false;
767 static const float_round_style round_style = round_toward_zero;
768 };
769
54c1bf78
BK
770 template<>
771 struct numeric_limits<long long>
772 {
773 static const bool is_specialized = true;
6ad8f949 774
54c1bf78 775 static long long min() throw()
6ad8f949 776 { return -__LONG_LONG_MAX__ - 1; }
54c1bf78 777 static long long max() throw()
6ad8f949
RH
778 { return __LONG_LONG_MAX__; }
779
780 static const int digits = __glibcpp_digits (long long);
781 static const int digits10 = __glibcpp_digits10 (long long);
54c1bf78
BK
782 static const bool is_signed = true;
783 static const bool is_integer = true;
784 static const bool is_exact = true;
785 static const int radix = 2;
786 static long long epsilon() throw()
787 { return 0; }
788 static long long round_error() throw()
789 { return 0; }
6ad8f949 790
54c1bf78
BK
791 static const int min_exponent = 0;
792 static const int min_exponent10 = 0;
793 static const int max_exponent = 0;
794 static const int max_exponent10 = 0;
6ad8f949 795
54c1bf78
BK
796 static const bool has_infinity = false;
797 static const bool has_quiet_NaN = false;
798 static const bool has_signaling_NaN = false;
799 static const float_denorm_style has_denorm = denorm_absent;
800 static const bool has_denorm_loss = false;
6ad8f949 801
54c1bf78
BK
802 static long long infinity() throw()
803 { return static_cast<long long>(0); }
804 static long long quiet_NaN() throw()
805 { return static_cast<long long>(0); }
806 static long long signaling_NaN() throw()
807 { return static_cast<long long>(0); }
808 static long long denorm_min() throw()
809 { return static_cast<long long>(0); }
6ad8f949 810
77bd447b 811 static const bool is_iec559 = false;
54c1bf78 812 static const bool is_bounded = true;
da28539c 813 static const bool is_modulo = true;
54c1bf78 814
da28539c 815 static const bool traps = __glibcpp_integral_traps;
54c1bf78
BK
816 static const bool tinyness_before = false;
817 static const float_round_style round_style = round_toward_zero;
818 };
819
54c1bf78
BK
820 template<>
821 struct numeric_limits<unsigned long long>
822 {
823 static const bool is_specialized = true;
824
825 static unsigned long long min() throw()
826 { return 0; }
827 static unsigned long long max() throw()
6ad8f949 828 { return __LONG_LONG_MAX__ * 2ULL + 1; }
54c1bf78 829
6ad8f949
RH
830 static const int digits = __glibcpp_digits (unsigned long long);
831 static const int digits10 = __glibcpp_digits10 (unsigned long long);
54c1bf78
BK
832 static const bool is_signed = false;
833 static const bool is_integer = true;
834 static const bool is_exact = true;
835 static const int radix = 2;
836 static unsigned long long epsilon() throw()
837 { return 0; }
838 static unsigned long long round_error() throw()
839 { return 0; }
840
841 static const int min_exponent = 0;
842 static const int min_exponent10 = 0;
843 static const int max_exponent = 0;
844 static const int max_exponent10 = 0;
845
846 static const bool has_infinity = false;
847 static const bool has_quiet_NaN = false;
848 static const bool has_signaling_NaN = false;
849 static const float_denorm_style has_denorm = denorm_absent;
850 static const bool has_denorm_loss = false;
851
852 static unsigned long long infinity() throw()
853 { return static_cast<unsigned long long>(0); }
854 static unsigned long long quiet_NaN() throw()
855 { return static_cast<unsigned long long>(0); }
856 static unsigned long long signaling_NaN() throw()
857 { return static_cast<unsigned long long>(0); }
858 static unsigned long long denorm_min() throw()
859 { return static_cast<unsigned long long>(0); }
860
77bd447b 861 static const bool is_iec559 = false;
54c1bf78
BK
862 static const bool is_bounded = true;
863 static const bool is_modulo = true;
864
da28539c 865 static const bool traps = __glibcpp_integral_traps;
54c1bf78
BK
866 static const bool tinyness_before = false;
867 static const float_round_style round_style = round_toward_zero;
868 };
869
54c1bf78
BK
870 template<>
871 struct numeric_limits<float>
872 {
873 static const bool is_specialized = true;
874
875 static float min() throw()
5e25fa22 876 { return __FLT_MIN__; }
54c1bf78 877 static float max() throw()
5e25fa22 878 { return __FLT_MAX__; }
54c1bf78 879
5e25fa22
RH
880 static const int digits = __FLT_MANT_DIG__;
881 static const int digits10 = __FLT_DIG__;
54c1bf78
BK
882 static const bool is_signed = true;
883 static const bool is_integer = false;
884 static const bool is_exact = false;
5e25fa22 885 static const int radix = __FLT_RADIX__;
54c1bf78 886 static float epsilon() throw()
5e25fa22 887 { return __FLT_EPSILON__; }
54c1bf78 888 static float round_error() throw()
be71ea9d 889 { return 0.5F; }
54c1bf78 890
5e25fa22
RH
891 static const int min_exponent = __FLT_MIN_EXP__;
892 static const int min_exponent10 = __FLT_MIN_10_EXP__;
893 static const int max_exponent = __FLT_MAX_EXP__;
894 static const int max_exponent10 = __FLT_MAX_10_EXP__;
54c1bf78 895
14d22dd6
MM
896 static const bool has_infinity = __FLT_HAS_INFINITY__;
897 static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
1472e41c 898 static const bool has_signaling_NaN = has_quiet_NaN;
ac520ec9
RH
899 static const float_denorm_style has_denorm
900 = __FLT_DENORM_MIN__ ? denorm_present : denorm_absent;
54c1bf78
BK
901 static const bool has_denorm_loss = __glibcpp_float_has_denorm_loss;
902
903 static float infinity() throw()
65e32b88 904 { return __builtin_huge_valf (); }
54c1bf78 905 static float quiet_NaN() throw()
1472e41c 906 { return __builtin_nanf (""); }
54c1bf78 907 static float signaling_NaN() throw()
1472e41c 908 { return __builtin_nansf (""); }
54c1bf78 909 static float denorm_min() throw()
ac520ec9 910 { return __FLT_DENORM_MIN__; }
54c1bf78 911
d3d09886
RH
912 static const bool is_iec559
913 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
da28539c 914 static const bool is_bounded = true;
6ad8f949 915 static const bool is_modulo = false;
54c1bf78
BK
916
917 static const bool traps = __glibcpp_float_traps;
918 static const bool tinyness_before = __glibcpp_float_tinyness_before;
be71ea9d 919 static const float_round_style round_style = round_to_nearest;
54c1bf78
BK
920 };
921
54c1bf78 922#undef __glibcpp_float_has_denorm_loss
54c1bf78
BK
923#undef __glibcpp_float_traps
924#undef __glibcpp_float_tinyness_before
54c1bf78
BK
925
926 template<>
927 struct numeric_limits<double>
928 {
929 static const bool is_specialized = true;
930
931 static double min() throw()
5e25fa22 932 { return __DBL_MIN__; }
54c1bf78 933 static double max() throw()
5e25fa22 934 { return __DBL_MAX__; }
54c1bf78 935
5e25fa22
RH
936 static const int digits = __DBL_MANT_DIG__;
937 static const int digits10 = __DBL_DIG__;
54c1bf78
BK
938 static const bool is_signed = true;
939 static const bool is_integer = false;
940 static const bool is_exact = false;
5e25fa22 941 static const int radix = __FLT_RADIX__;
54c1bf78 942 static double epsilon() throw()
5e25fa22 943 { return __DBL_EPSILON__; }
54c1bf78 944 static double round_error() throw()
be71ea9d 945 { return 0.5; }
54c1bf78 946
5e25fa22
RH
947 static const int min_exponent = __DBL_MIN_EXP__;
948 static const int min_exponent10 = __DBL_MIN_10_EXP__;
949 static const int max_exponent = __DBL_MAX_EXP__;
950 static const int max_exponent10 = __DBL_MAX_10_EXP__;
54c1bf78 951
14d22dd6
MM
952 static const bool has_infinity = __DBL_HAS_INFINITY__;
953 static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
1472e41c 954 static const bool has_signaling_NaN = has_quiet_NaN;
ac520ec9
RH
955 static const float_denorm_style has_denorm
956 = __DBL_DENORM_MIN__ ? denorm_present : denorm_absent;
54c1bf78
BK
957 static const bool has_denorm_loss = __glibcpp_double_has_denorm_loss;
958
959 static double infinity() throw()
65e32b88 960 { return __builtin_huge_val(); }
54c1bf78 961 static double quiet_NaN() throw()
1472e41c 962 { return __builtin_nan (""); }
54c1bf78 963 static double signaling_NaN() throw()
1472e41c 964 { return __builtin_nans (""); }
54c1bf78 965 static double denorm_min() throw()
ac520ec9 966 { return __DBL_DENORM_MIN__; }
54c1bf78 967
d3d09886
RH
968 static const bool is_iec559
969 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
da28539c 970 static const bool is_bounded = true;
6ad8f949 971 static const bool is_modulo = false;
54c1bf78
BK
972
973 static const bool traps = __glibcpp_double_traps;
974 static const bool tinyness_before = __glibcpp_double_tinyness_before;
be71ea9d 975 static const float_round_style round_style = round_to_nearest;
54c1bf78
BK
976 };
977
54c1bf78 978#undef __glibcpp_double_has_denorm_loss
54c1bf78
BK
979#undef __glibcpp_double_traps
980#undef __glibcpp_double_tinyness_before
6ad8f949 981
54c1bf78
BK
982 template<>
983 struct numeric_limits<long double>
984 {
985 static const bool is_specialized = true;
986
987 static long double min() throw()
5e25fa22 988 { return __LDBL_MIN__; }
54c1bf78 989 static long double max() throw()
5e25fa22 990 { return __LDBL_MAX__; }
54c1bf78 991
5e25fa22
RH
992 static const int digits = __LDBL_MANT_DIG__;
993 static const int digits10 = __LDBL_DIG__;
54c1bf78
BK
994 static const bool is_signed = true;
995 static const bool is_integer = false;
996 static const bool is_exact = false;
5e25fa22 997 static const int radix = __FLT_RADIX__;
54c1bf78 998 static long double epsilon() throw()
5e25fa22 999 { return __LDBL_EPSILON__; }
54c1bf78 1000 static long double round_error() throw()
be71ea9d 1001 { return 0.5L; }
54c1bf78 1002
5e25fa22
RH
1003 static const int min_exponent = __LDBL_MIN_EXP__;
1004 static const int min_exponent10 = __LDBL_MIN_10_EXP__;
1005 static const int max_exponent = __LDBL_MAX_EXP__;
1006 static const int max_exponent10 = __LDBL_MAX_10_EXP__;
54c1bf78 1007
14d22dd6
MM
1008 static const bool has_infinity = __LDBL_HAS_INFINITY__;
1009 static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
1472e41c 1010 static const bool has_signaling_NaN = has_quiet_NaN;
ac520ec9
RH
1011 static const float_denorm_style has_denorm
1012 = __LDBL_DENORM_MIN__ ? denorm_present : denorm_absent;
1013 static const bool has_denorm_loss
1014 = __glibcpp_long_double_has_denorm_loss;
54c1bf78
BK
1015
1016 static long double infinity() throw()
6ad8f949 1017 { return __builtin_huge_vall (); }
54c1bf78 1018 static long double quiet_NaN() throw()
1472e41c 1019 { return __builtin_nanl (""); }
54c1bf78 1020 static long double signaling_NaN() throw()
1472e41c 1021 { return __builtin_nansl (""); }
54c1bf78 1022 static long double denorm_min() throw()
ac520ec9 1023 { return __LDBL_DENORM_MIN__; }
54c1bf78 1024
d3d09886
RH
1025 static const bool is_iec559
1026 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
da28539c 1027 static const bool is_bounded = true;
6ad8f949 1028 static const bool is_modulo = false;
54c1bf78 1029
6ad8f949 1030 static const bool traps = __glibcpp_long_double_traps;
54c1bf78 1031 static const bool tinyness_before = __glibcpp_long_double_tinyness_before;
be71ea9d 1032 static const float_round_style round_style = round_to_nearest;
54c1bf78
BK
1033 };
1034
54c1bf78 1035#undef __glibcpp_long_double_has_denorm_loss
54c1bf78
BK
1036#undef __glibcpp_long_double_traps
1037#undef __glibcpp_long_double_tinyness_before
be71ea9d 1038
54c1bf78
BK
1039} // namespace std
1040
6ad8f949
RH
1041#undef __glibcpp_signed
1042#undef __glibcpp_min
1043#undef __glibcpp_max
1044#undef __glibcpp_digits
1045#undef __glibcpp_digits10
1046
54c1bf78 1047#endif // _CPP_NUMERIC_LIMITS