]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/include/std/std_limits.h
std_limits.h (__glibcpp_f32_is_iec559, [...]): Remove.
[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
ffe94f83 3// Copyright (C) 1999, 2000, 2001, 2002 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
48#include <bits/cpu_limits.h>
49#include <bits/c++config.h>
50
51//
52// The numeric_limits<> traits document implementation-defined aspects
53// of fundamental arithmetic data types (integers and floating points).
54// From Standard C++ point of view, there are 13 such types:
55// * integers
56// bool (1)
57// char, signed char, unsigned char (3)
58// short, unsigned short (2)
59// int, unsigned (2)
60// long, unsigned long (2)
61//
62// * floating points
63// float (1)
64// double (1)
65// long double (1)
66//
67// GNU C++ undertstands (where supported by the host C-library)
68// * integer
69// long long, unsigned long long (2)
70//
71// which brings us to 15 fundamental arithmetic data types in GNU C++.
72//
73//
74// Since a numeric_limits<> is a bit tricky to get right, we rely on
75// an interface composed of macros which should be defined in config/os
76// or config/cpu when they differ from the generic (read arbitrary)
77// definitions given here.
78//
79
54c1bf78 80#ifdef __CHAR_UNSIGNED__
f3cd98c4 81# define __glibcpp_plain_char_is_signed false
54c1bf78 82#else
f3cd98c4 83# define __glibcpp_plain_char_is_signed true
54c1bf78 84#endif
585e661a
GDR
85
86#ifndef __WCHAR_UNSIGNED__
87# define __glibcpp_wchar_t_is_signed false
88#else
f3cd98c4 89# define __glibcpp_wchar_t_is_signed true
54c1bf78 90#endif
585e661a
GDR
91
92// These values can be overridden in the target configuration file.
93// The default values are appropriate for many 32-bit targets.
54c1bf78
BK
94
95#ifndef __glibcpp_char_traps
f3cd98c4 96# define __glibcpp_char_traps true
54c1bf78
BK
97#endif
98#ifndef __glibcpp_short_traps
f3cd98c4 99# define __glibcpp_short_traps true
54c1bf78
BK
100#endif
101#ifndef __glibcpp_int_traps
f3cd98c4 102# define __glibcpp_int_traps true
54c1bf78
BK
103#endif
104#ifndef __glibcpp_long_traps
f3cd98c4 105# define __glibcpp_long_traps true
54c1bf78
BK
106#endif
107#ifndef __glibcpp_wchar_t_traps
f3cd98c4 108# define __glibcpp_wchar_t_traps true
54c1bf78
BK
109#endif
110#ifndef __glibcpp_long_long_traps
f3cd98c4 111# define __glibcpp_long_long_traps true
54c1bf78
BK
112#endif
113
114// You should not need to define any macros below this point, unless
115// you have a machine with non-standard bit-widths.
116
117// These values are the minimums and maximums for standard data types
118// of common widths.
119
120#define __glibcpp_s8_max 127
121#define __glibcpp_s8_min (-__glibcpp_s8_max - 1)
122#define __glibcpp_s8_digits 7
123#define __glibcpp_s8_digits10 2
124#define __glibcpp_u8_min 0U
125#define __glibcpp_u8_max (__glibcpp_s8_max * 2 + 1)
126#define __glibcpp_u8_digits 8
127#define __glibcpp_u8_digits10 2
128#define __glibcpp_s16_max 32767
129#define __glibcpp_s16_min (-__glibcpp_s16_max - 1)
130#define __glibcpp_s16_digits 15
131#define __glibcpp_s16_digits10 4
132#define __glibcpp_u16_min 0U
133#define __glibcpp_u16_max (__glibcpp_s16_max * 2 + 1)
134#define __glibcpp_u16_digits 16
135#define __glibcpp_u16_digits10 4
136#define __glibcpp_s32_max 2147483647L
137#define __glibcpp_s32_min (-__glibcpp_s32_max - 1)
138#define __glibcpp_s32_digits 31
139#define __glibcpp_s32_digits10 9
140#define __glibcpp_u32_min 0UL
141#define __glibcpp_u32_max (__glibcpp_s32_max * 2U + 1)
142#define __glibcpp_u32_digits 32
143#define __glibcpp_u32_digits10 9
144#define __glibcpp_s64_max 9223372036854775807LL
145#define __glibcpp_s64_min (-__glibcpp_s64_max - 1)
146#define __glibcpp_s64_digits 63
147#define __glibcpp_s64_digits10 18
148#define __glibcpp_u64_min 0ULL
149#define __glibcpp_u64_max (__glibcpp_s64_max * 2ULL + 1)
150#define __glibcpp_u64_digits 64
151#define __glibcpp_u64_digits10 19
152
54c1bf78
BK
153// bool-specific hooks:
154// __glibcpp_bool_digits __glibcpp_int_traps __glibcpp_long_traps
155
54c1bf78 156#ifndef __glibcpp_bool_digits
f3cd98c4 157# define __glibcpp_bool_digits 1
54c1bf78
BK
158#endif
159
160// char.
161
162#define __glibcpp_plain_char_traps true
163#define __glibcpp_signed_char_traps true
164#define __glibcpp_unsigned_char_traps true
165#ifndef __glibcpp_char_is_modulo
f3cd98c4 166# define __glibcpp_char_is_modulo true
54c1bf78
BK
167#endif
168#ifndef __glibcpp_signed_char_is_modulo
f3cd98c4 169# define __glibcpp_signed_char_is_modulo true
54c1bf78 170#endif
585e661a 171#if __CHAR_BIT__ == 8
f3cd98c4
GDR
172# define __glibcpp_signed_char_min __glibcpp_s8_min
173# define __glibcpp_signed_char_max __glibcpp_s8_max
174# define __glibcpp_signed_char_digits __glibcpp_s8_digits
175# define __glibcpp_signed_char_digits10 __glibcpp_s8_digits10
176# define __glibcpp_unsigned_char_min __glibcpp_u8_min
177# define __glibcpp_unsigned_char_max __glibcpp_u8_max
178# define __glibcpp_unsigned_char_digits __glibcpp_u8_digits
179# define __glibcpp_unsigned_char_digits10 __glibcpp_u8_digits10
585e661a 180#elif __CHAR_BIT__ == 16
f3cd98c4
GDR
181# define __glibcpp_signed_char_min __glibcpp_s16_min
182# define __glibcpp_signed_char_max __glibcpp_s16_max
183# define __glibcpp_signed_char_digits __glibcpp_s16_digits
184# define __glibcpp_signed_char_digits10 __glibcpp_s16_digits10
185# define __glibcpp_unsigned_char_min __glibcpp_u16_min
186# define __glibcpp_unsigned_char_max __glibcpp_u16_max
187# define __glibcpp_unsigned_char_digits __glibcpp_u16_digits
188# define __glibcpp_unsigned_char_digits10 __glibcpp_u16_digits10
585e661a 189#elif __CHAR_BIT__ == 32
f3cd98c4
GDR
190# define __glibcpp_signed_char_min (signed char)__glibcpp_s32_min
191# define __glibcpp_signed_char_max (signed char)__glibcpp_s32_max
192# define __glibcpp_signed_char_digits __glibcpp_s32_digits
193# define __glibcpp_signed_char_digits10 __glibcpp_s32_digits10
194# define __glibcpp_unsigned_char_min (unsigned char)__glibcpp_u32_min
195# define __glibcpp_unsigned_char_max (unsigned char)__glibcpp_u32_max
196# define __glibcpp_unsigned_char_digits __glibcpp_u32_digits
197# define __glibcpp_unsigned_char_digits10 __glibcpp_u32_digits10
585e661a 198#elif __CHAR_BIT__ == 64
f3cd98c4
GDR
199# define __glibcpp_signed_char_min (signed char)__glibcpp_s64_min
200# define __glibcpp_signed_char_max (signed char)__glibcpp_s64_max
201# define __glibcpp_signed_char_digits __glibcpp_s64_digits
202# define __glibcpp_signed_char_digits10 __glibcpp_s64_digits10
203# define __glibcpp_unsigned_char_min (unsigned char)__glibcpp_u64_min
204# define __glibcpp_unsigned_char_max (unsigned char)__glibcpp_u64_max
205# define __glibcpp_unsigned_char_digits __glibcpp_u64_digits
206# define __glibcpp_unsigned_char_digits10 __glibcpp_u64_digits10
54c1bf78
BK
207#else
208// You must define these macros in the configuration file.
209#endif
210
211#if __glibcpp_plain_char_is_signed
f3cd98c4
GDR
212# define __glibcpp_char_min (char)__glibcpp_signed_char_min
213# define __glibcpp_char_max (char)__glibcpp_signed_char_max
214# define __glibcpp_char_digits __glibcpp_signed_char_digits
215# define __glibcpp_char_digits10 __glibcpp_signed_char_digits
54c1bf78 216#else
f3cd98c4
GDR
217# define __glibcpp_char_min (char)__glibcpp_unsigned_char_min
218# define __glibcpp_char_max (char)__glibcpp_unsigned_char_max
219# define __glibcpp_char_digits __glibcpp_unsigned_char_digits
220# define __glibcpp_char_digits10 __glibcpp_unsigned_char_digits
54c1bf78
BK
221#endif
222
223// short
224
225#define __glibcpp_signed_short_traps true
226#define __glibcpp_unsigned_short_traps true
227#ifndef __glibcpp_signed_short_is_modulo
f3cd98c4 228# define __glibcpp_signed_short_is_modulo true
54c1bf78 229#endif
585e661a 230#if __SHRT_BIT__ == 8
f3cd98c4
GDR
231# define __glibcpp_signed_short_min __glibcpp_s8_min
232# define __glibcpp_signed_short_max __glibcpp_s8_max
233# define __glibcpp_signed_short_digits __glibcpp_s8_digits
234# define __glibcpp_signed_short_digits10 __glibcpp_s8_digits10
235# define __glibcpp_unsigned_short_min __glibcpp_u8_min
236# define __glibcpp_unsigned_short_max __glibcpp_u8_max
237# define __glibcpp_unsigned_short_digits __glibcpp_u8_digits
238# define __glibcpp_unsigned_short_digits10 __glibcpp_u8_digits10
585e661a 239#elif __SHRT_BIT__ == 16
f3cd98c4
GDR
240# define __glibcpp_signed_short_min __glibcpp_s16_min
241# define __glibcpp_signed_short_max __glibcpp_s16_max
242# define __glibcpp_signed_short_digits __glibcpp_s16_digits
243# define __glibcpp_signed_short_digits10 __glibcpp_s16_digits10
244# define __glibcpp_unsigned_short_min __glibcpp_u16_min
245# define __glibcpp_unsigned_short_max __glibcpp_u16_max
246# define __glibcpp_unsigned_short_digits __glibcpp_u16_digits
247# define __glibcpp_unsigned_short_digits10 __glibcpp_u16_digits10
585e661a 248#elif __SHRT_BIT__ == 32
f3cd98c4
GDR
249# define __glibcpp_signed_short_min (short)__glibcpp_s32_min
250# define __glibcpp_signed_short_max (short)__glibcpp_s32_max
251# define __glibcpp_signed_short_digits __glibcpp_s32_digits
252# define __glibcpp_signed_short_digits10 __glibcpp_s32_digits10
253# define __glibcpp_unsigned_short_min (unsigned short)__glibcpp_u32_min
254# define __glibcpp_unsigned_short_max (unsigned short)__glibcpp_u32_max
255# define __glibcpp_unsigned_short_digits __glibcpp_u32_digits
256# define __glibcpp_unsigned_short_digits10 __glibcpp_u32_digits10
585e661a 257#elif __SHRT_BIT__ == 64
f3cd98c4
GDR
258# define __glibcpp_signed_short_min (short)__glibcpp_s64_min
259# define __glibcpp_signed_short_max (short)__glibcpp_s64_max
260# define __glibcpp_signed_short_digits __glibcpp_s64_digits
261# define __glibcpp_signed_short_digits10 __glibcpp_s64_digits10
262# define __glibcpp_unsigned_short_min (unsigned short)__glibcpp_u64_min
263# define __glibcpp_unsigned_short_max (unsigned short)__glibcpp_u64_max
264# define __glibcpp_unsigned_short_digits __glibcpp_u64_digits
265# define __glibcpp_unsigned_short_digits10 __glibcpp_u64_digits10
54c1bf78
BK
266#else
267// You must define these macros in the configuration file.
268#endif
269
270// int
271
272#define __glibcpp_signed_int_traps true
273#define __glibcpp_unsigned_int_traps true
274#ifndef __glibcpp_signed_int_is_modulo
f3cd98c4 275# define __glibcpp_signed_int_is_modulo true
54c1bf78 276#endif
585e661a 277#if __INT_BIT__ == 8
f3cd98c4
GDR
278# define __glibcpp_signed_int_min __glibcpp_s8_min
279# define __glibcpp_signed_int_max __glibcpp_s8_max
280# define __glibcpp_signed_int_digits __glibcpp_s8_digits
281# define __glibcpp_signed_int_digits10 __glibcpp_s8_digits10
282# define __glibcpp_unsigned_int_min __glibcpp_u8_min
283# define __glibcpp_unsigned_int_max __glibcpp_u8_max
284# define __glibcpp_unsigned_int_digits __glibcpp_u8_digits
285# define __glibcpp_unsigned_int_digits10 __glibcpp_u8_digits10
585e661a 286#elif __INT_BIT__ == 16
f3cd98c4
GDR
287# define __glibcpp_signed_int_min __glibcpp_s16_min
288# define __glibcpp_signed_int_max __glibcpp_s16_max
289# define __glibcpp_signed_int_digits __glibcpp_s16_digits
290# define __glibcpp_signed_int_digits10 __glibcpp_s16_digits10
291# define __glibcpp_unsigned_int_min __glibcpp_u16_min
292# define __glibcpp_unsigned_int_max __glibcpp_u16_max
293# define __glibcpp_unsigned_int_digits __glibcpp_u16_digits
294# define __glibcpp_unsigned_int_digits10 __glibcpp_u16_digits10
585e661a 295#elif __INT_BIT__ == 32
f3cd98c4
GDR
296# define __glibcpp_signed_int_min (int)__glibcpp_s32_min
297# define __glibcpp_signed_int_max (int)__glibcpp_s32_max
298# define __glibcpp_signed_int_digits __glibcpp_s32_digits
299# define __glibcpp_signed_int_digits10 __glibcpp_s32_digits10
300# define __glibcpp_unsigned_int_min (unsigned)__glibcpp_u32_min
301# define __glibcpp_unsigned_int_max (unsigned)__glibcpp_u32_max
302# define __glibcpp_unsigned_int_digits __glibcpp_u32_digits
303# define __glibcpp_unsigned_int_digits10 __glibcpp_u32_digits10
585e661a 304#elif __INT_BIT__ == 64
f3cd98c4
GDR
305# define __glibcpp_signed_int_min (int)__glibcpp_s64_min
306# define __glibcpp_signed_int_max (int)__glibcpp_s64_max
307# define __glibcpp_signed_int_digits __glibcpp_s64_digits
308# define __glibcpp_signed_int_digits10 __glibcpp_s64_digits10
309# define __glibcpp_unsigned_int_min (unsigned)__glibcpp_u64_min
310# define __glibcpp_unsigned_int_max (unsigned)__glibcpp_u64_max
311# define __glibcpp_unsigned_int_digits __glibcpp_u64_digits
312# define __glibcpp_unsigned_int_digits10 __glibcpp_u64_digits10
54c1bf78
BK
313#else
314// You must define these macros in the configuration file.
315#endif
316
317// long
318
319#define __glibcpp_signed_long_traps true
320#define __glibcpp_unsigned_long_traps true
321#ifndef __glibcpp_signed_long_is_modulo
f3cd98c4 322# define __glibcpp_signed_long_is_modulo true
54c1bf78 323#endif
585e661a 324#if __LONG_BIT__ == 8
f3cd98c4
GDR
325# define __glibcpp_signed_long_min __glibcpp_s8_min
326# define __glibcpp_signed_long_max __glibcpp_s8_max
327# define __glibcpp_signed_long_digits __glibcpp_s8_digits
328# define __glibcpp_signed_long_digits10 __glibcpp_s8_digits10
329# define __glibcpp_unsigned_long_min __glibcpp_u8_min
330# define __glibcpp_unsigned_long_max __glibcpp_u8_max
331# define __glibcpp_unsigned_long_digits __glibcpp_u8_digits
332# define __glibcpp_unsigned_long_digits10 __glibcpp_u8_digits10
585e661a 333#elif __LONG_BIT__ == 16
f3cd98c4
GDR
334# define __glibcpp_signed_long_min __glibcpp_s16_min
335# define __glibcpp_signed_long_max __glibcpp_s16_max
336# define __glibcpp_signed_long_digits __glibcpp_s16_digits
337# define __glibcpp_signed_long_digits10 __glibcpp_s16_digits10
338# define __glibcpp_unsigned_long_min __glibcpp_u16_min
339# define __glibcpp_unsigned_long_max __glibcpp_u16_max
340# define __glibcpp_unsigned_long_digits __glibcpp_u16_digits
341# define __glibcpp_unsigned_long_digits10 __glibcpp_u16_digits10
585e661a 342#elif __LONG_BIT__ == 32
f3cd98c4
GDR
343# define __glibcpp_signed_long_min __glibcpp_s32_min
344# define __glibcpp_signed_long_max __glibcpp_s32_max
345# define __glibcpp_signed_long_digits __glibcpp_s32_digits
346# define __glibcpp_signed_long_digits10 __glibcpp_s32_digits10
347# define __glibcpp_unsigned_long_min __glibcpp_u32_min
348# define __glibcpp_unsigned_long_max __glibcpp_u32_max
349# define __glibcpp_unsigned_long_digits __glibcpp_u32_digits
350# define __glibcpp_unsigned_long_digits10 __glibcpp_u32_digits10
585e661a 351#elif __LONG_BIT__ == 64
f3cd98c4
GDR
352# define __glibcpp_signed_long_min (long)__glibcpp_s64_min
353# define __glibcpp_signed_long_max (long)__glibcpp_s64_max
354# define __glibcpp_signed_long_digits __glibcpp_s64_digits
355# define __glibcpp_signed_long_digits10 __glibcpp_s64_digits10
356# define __glibcpp_unsigned_long_min (unsigned long)__glibcpp_u64_min
357# define __glibcpp_unsigned_long_max (unsigned long)__glibcpp_u64_max
358# define __glibcpp_unsigned_long_digits __glibcpp_u64_digits
359# define __glibcpp_unsigned_long_digits10 __glibcpp_u64_digits10
54c1bf78
BK
360#else
361// You must define these macros in the configuration file.
362#endif
363
364// long long
365
366#define __glibcpp_signed_long_long_traps true
367#define __glibcpp_signed_long_long_traps true
368#ifndef __glibcpp_signed_long_long_is_modulo
f3cd98c4 369# define __glibcpp_signed_long_long_is_modulo true
54c1bf78 370#endif
585e661a 371#if __LONG_LONG_BIT__ == 8
f3cd98c4
GDR
372# define __glibcpp_signed_long_long_min __glibcpp_s8_min
373# define __glibcpp_signed_long_long_max __glibcpp_s8_max
374# define __glibcpp_signed_long_long_digits __glibcpp_s8_digits
375# define __glibcpp_signed_long_long_digits10 __glibcpp_s8_digits10
376# define __glibcpp_unsigned_long_long_min __glibcpp_u8_min
377# define __glibcpp_unsigned_long_long_max __glibcpp_u8_max
378# define __glibcpp_unsigned_long_long_digits __glibcpp_u8_digits
379# define __glibcpp_unsigned_long_long_digits10 __glibcpp_u8_digits10
585e661a 380#elif __LONG_LONG_BIT__ == 16
f3cd98c4
GDR
381# define __glibcpp_signed_long_long_min __glibcpp_s16_min
382# define __glibcpp_signed_long_long_max __glibcpp_s16_max
383# define __glibcpp_signed_long_long_digits __glibcpp_s16_digits
384# define __glibcpp_signed_long_long_digits10 __glibcpp_s16_digits10
385# define __glibcpp_unsigned_long_long_min __glibcpp_u16_min
386# define __glibcpp_unsigned_long_long_max __glibcpp_u16_max
387# define __glibcpp_unsigned_long_long_digits __glibcpp_u16_digits
388# define __glibcpp_unsigned_long_long_digits10 __glibcpp_u16_digits10
585e661a 389#elif __LONG_LONG_BIT__ == 32
f3cd98c4
GDR
390# define __glibcpp_signed_long_long_min __glibcpp_s32_min
391# define __glibcpp_signed_long_long_max __glibcpp_s32_max
392# define __glibcpp_signed_long_long_digits __glibcpp_s32_digits
393# define __glibcpp_signed_long_long_digits10 __glibcpp_s32_digits10
394# define __glibcpp_unsigned_long_long_min __glibcpp_u32_min
395# define __glibcpp_unsigned_long_long_max __glibcpp_u32_max
396# define __glibcpp_unsigned_long_long_digits __glibcpp_u32_digits
397# define __glibcpp_unsigned_long_long_digits10 __glibcpp_u32_digits10
585e661a 398#elif __LONG_LONG_BIT__ == 64
f3cd98c4
GDR
399# define __glibcpp_signed_long_long_min __glibcpp_s64_min
400# define __glibcpp_signed_long_long_max __glibcpp_s64_max
401# define __glibcpp_signed_long_long_digits __glibcpp_s64_digits
402# define __glibcpp_signed_long_long_digits10 __glibcpp_s64_digits10
403# define __glibcpp_signed_long_long_traps true
404# define __glibcpp_unsigned_long_long_min __glibcpp_u64_min
405# define __glibcpp_unsigned_long_long_max __glibcpp_u64_max
406# define __glibcpp_unsigned_long_long_digits __glibcpp_u64_digits
407# define __glibcpp_unsigned_long_long_digits10 __glibcpp_u64_digits10
408# define __glibcpp_unsigned_long_long_traps true
54c1bf78
BK
409#else
410// You must define these macros in the configuration file.
411#endif
412
413// wchar_t
414
415#define __glibcpp_wchar_t_traps true
416#ifndef __glibcpp_wchar_t_is_modulo
f3cd98c4 417# define __glibcpp_wchar_t_is_modulo true
54c1bf78
BK
418#endif
419#if __glibcpp_wchar_t_is_signed
585e661a 420# if __WCHAR_BIT__ == 8
f3cd98c4
GDR
421# define __glibcpp_wchar_t_min __glibcpp_s8_min
422# define __glibcpp_wchar_t_max __glibcpp_s8_max
423# define __glibcpp_wchar_t_digits __glibcpp_s8_digits
424# define __glibcpp_wchar_t_digits10 __glibcpp_s8_digits10
585e661a 425# elif __WCHAR_BIT__ == 16
f3cd98c4
GDR
426# define __glibcpp_wchar_t_min __glibcpp_s16_min
427# define __glibcpp_wchar_t_max __glibcpp_s16_max
428# define __glibcpp_wchar_t_digits __glibcpp_s16_digits
429# define __glibcpp_wchar_t_digits10 __glibcpp_s16_digits10
585e661a 430# elif __WCHAR_BIT__ == 32
f3cd98c4
GDR
431# define __glibcpp_wchar_t_min (wchar_t)__glibcpp_s32_min
432# define __glibcpp_wchar_t_max (wchar_t)__glibcpp_s32_max
433# define __glibcpp_wchar_t_digits __glibcpp_s32_digits
434# define __glibcpp_wchar_t_digits10 __glibcpp_s32_digits10
585e661a 435# elif __WCHAR_BIT__ == 64
f3cd98c4
GDR
436# define __glibcpp_wchar_t_min (wchar_t)__glibcpp_s64_min
437# define __glibcpp_wchar_t_max (wchar_t)__glibcpp_s64_max
438# define __glibcpp_wchar_t_digits __glibcpp_s64_digits
439# define __glibcpp_wchar_t_digits10 __glibcpp_s64_digits10
440# else
54c1bf78 441// You must define these macros in the configuration file.
f3cd98c4 442# endif
54c1bf78 443#else
585e661a 444# if __WCHAR_BIT__ == 8
f3cd98c4
GDR
445# define __glibcpp_wchar_t_min __glibcpp_u8_min
446# define __glibcpp_wchar_t_max __glibcpp_u8_max
447# define __glibcpp_wchar_t_digits __glibcpp_u8_digits
448# define __glibcpp_wchar_t_digits10 __glibcpp_u8_digits10
585e661a 449# elif __WCHAR_BIT__ == 16
f3cd98c4
GDR
450# define __glibcpp_wchar_t_min __glibcpp_u16_min
451# define __glibcpp_wchar_t_max __glibcpp_u16_max
452# define __glibcpp_wchar_t_digits __glibcpp_u16_digits
453# define __glibcpp_wchar_t_digits10 __glibcpp_u16_digits10
585e661a 454# elif __WCHAR_BIT__ == 32
f3cd98c4
GDR
455# define __glibcpp_wchar_t_min (wchar_t)__glibcpp_u32_min
456# define __glibcpp_wchar_t_max (wchar_t)__glibcpp_u32_max
457# define __glibcpp_wchar_t_digits __glibcpp_u32_digits
458# define __glibcpp_wchar_t_digits10 __glibcpp_u32_digits10
585e661a 459# elif __WCHAR_BIT__ == 64
f3cd98c4
GDR
460# define __glibcpp_wchar_t_min (wchar_t)__glibcpp_u64_min
461# define __glibcpp_wchar_t_max (wchar_t)__glibcpp_u64_max
462# define __glibcpp_wchar_t_digits __glibcpp_u64_digits
463# define __glibcpp_wchar_t_digits10 __glibcpp_u64_digits10
464# else
54c1bf78 465// You must define these macros in the configuration file.
f3cd98c4 466# endif
54c1bf78
BK
467#endif
468
469// float
470//
471
2559486f 472// Default values. Should be overriden in configuration files if necessary.
54c1bf78 473
54c1bf78 474#ifndef __glibcpp_float_has_denorm_loss
f3cd98c4 475# define __glibcpp_float_has_denorm_loss false
54c1bf78
BK
476#endif
477
2559486f
GDR
478#ifndef __glibcpp_float_is_bounded
479# define __glibcpp_float_is_bounded true
54c1bf78
BK
480#endif
481
54c1bf78 482#ifndef __glibcpp_float_is_modulo
f3cd98c4 483# define __glibcpp_float_is_modulo false
54c1bf78
BK
484#endif
485
486#ifndef __glibcpp_float_traps
f3cd98c4 487# define __glibcpp_float_traps false
54c1bf78
BK
488#endif
489
490#ifndef __glibcpp_float_tinyness_before
f3cd98c4 491# define __glibcpp_float_tinyness_before false
54c1bf78
BK
492#endif
493
54c1bf78
BK
494// double
495
2559486f 496// Default values. Should be overriden in configuration files if necessary.
54c1bf78 497
54c1bf78 498#ifndef __glibcpp_double_has_denorm_loss
f3cd98c4 499# define __glibcpp_double_has_denorm_loss false
54c1bf78
BK
500#endif
501
54c1bf78 502#ifndef __glibcpp_double_is_bounded
f3cd98c4 503# define __glibcpp_double_is_bounded true
54c1bf78
BK
504#endif
505
506#ifndef __glibcpp_double_is_modulo
f3cd98c4 507# define __glibcpp_double_is_modulo false
54c1bf78
BK
508#endif
509
510#ifndef __glibcpp_double_traps
f3cd98c4 511# define __glibcpp_double_traps false
54c1bf78
BK
512#endif
513
514#ifndef __glibcpp_double_tinyness_before
f3cd98c4 515# define __glibcpp_double_tinyness_before false
54c1bf78
BK
516#endif
517
54c1bf78
BK
518// long double
519
2559486f 520// Default values. Should be overriden in configuration files if necessary.
54c1bf78 521
54c1bf78 522#ifndef __glibcpp_long_double_has_denorm_loss
f3cd98c4 523# define __glibcpp_long_double_has_denorm_loss false
54c1bf78
BK
524#endif
525
54c1bf78 526#ifndef __glibcpp_long_double_is_bounded
f3cd98c4 527# define __glibcpp_long_double_is_bounded true
54c1bf78
BK
528#endif
529
530#ifndef __glibcpp_long_double_is_modulo
f3cd98c4 531# define __glibcpp_long_double_is_modulo false
54c1bf78
BK
532#endif
533
534#ifndef __glibcpp_long_double_traps
f3cd98c4 535# define __glibcpp_long_double_traps false
54c1bf78
BK
536#endif
537
538#ifndef __glibcpp_long_double_tinyness_before
f3cd98c4 539# define __glibcpp_long_double_tinyness_before false
725dc051 540#endif
54c1bf78 541
54c1bf78
BK
542
543namespace std
544{
2559486f
GDR
545 // This is better handled by the compiler, but we do it here for the
546 // time being. (We're just second-guessing something the compiler
547 // knows about better than we do.) -- Gaby
548 typedef unsigned char __glibcpp_byte;
549#define __glibcpp_word_bits 32
585e661a 550#if __CHAR_BIT__ == __glibcpp_word_bits
2559486f 551# define __glibcpp_word unsigned char
585e661a 552#elif __SHRT_BIT__ == __glibcpp_word_bits
2559486f 553# define __glibcpp_word unsigned short
585e661a 554#elif __INT_BIT__ == __glibcpp_word_bits
2559486f 555# define __glibcpp_word unsigned int
585e661a 556#elif __LONG_BIT__ == __glibcpp_word_bits
2559486f
GDR
557# define __glibcpp_word unsigned long
558#endif
559
560 // Define storage types for the single, double and extended floating
561 // point data types. Maybe we could avoid the conditional #defines by
562 // using the aligned_storage<> extension. -- Gaby
563 typedef const
585e661a 564#if __FLOAT_BIT__ % __glibcpp_word_bits == 0
2559486f
GDR
565 __glibcpp_word __float_storage[sizeof (float) / sizeof (__glibcpp_word)]
566#else
567 __glibcpp_byte __float_storage[sizeof (float)]
568#endif
569 __attribute__((__aligned__(__alignof__(float))));
570
571 typedef const
585e661a 572#if __DOUBLE_BIT__ % __glibcpp_word_bits == 0
2559486f
GDR
573 __glibcpp_word __double_storage[sizeof (double) / sizeof (__glibcpp_word)]
574#else
575 __glibcpp_byte __double_storage[sizeof (double)]
576#endif
577 __attribute__((__aligned__(__alignof__(double))));
578
579 typedef const
585e661a 580#if __LONG_DOUBLE_BIT__ % __glibcpp_word_bits == 0
2559486f
GDR
581 __glibcpp_word __long_double_storage[sizeof (long double) / sizeof (__glibcpp_word)]
582#else
583 __glibcpp_byte __long_double_storage[sizeof (long double)]
584#endif
585 __attribute__((__aligned__(__alignof__(long double))));
586
54c1bf78
BK
587 enum float_round_style
588 {
589 round_indeterminate = -1,
590 round_toward_zero = 0,
591 round_to_nearest = 1,
592 round_toward_infinity = 2,
593 round_toward_neg_infinity = 3
594 };
595
596 enum float_denorm_style
597 {
598 denorm_indeterminate = -1,
599 denorm_absent = 0,
600 denorm_present = 1
601 };
602
603 //
604 // The primary class traits
605 //
84979344
BK
606 struct __numeric_limits_base
607 {
608 static const bool is_specialized = false;
609
610 static const int digits = 0;
611 static const int digits10 = 0;
612 static const bool is_signed = false;
613 static const bool is_integer = false;
614 static const bool is_exact = false;
615 static const int radix = 0;
616
617 static const int min_exponent = 0;
618 static const int min_exponent10 = 0;
619 static const int max_exponent = 0;
620 static const int max_exponent10 = 0;
621
622 static const bool has_infinity = false;
623 static const bool has_quiet_NaN = false;
624 static const bool has_signaling_NaN = false;
625 static const float_denorm_style has_denorm = denorm_absent;
626 static const bool has_denorm_loss = false;
627
628 static const bool is_iec559 = false;
629 static const bool is_bounded = false;
630 static const bool is_modulo = false;
631
632 static const bool traps = false;
633 static const bool tinyness_before = false;
634 static const float_round_style round_style = round_toward_zero;
635 };
636
54c1bf78 637 template<typename _Tp>
84979344 638 struct numeric_limits : public __numeric_limits_base
54c1bf78 639 {
54c1bf78
BK
640 static _Tp min() throw() { return static_cast<_Tp>(0); }
641 static _Tp max() throw() { return static_cast<_Tp>(0); }
54c1bf78
BK
642 static _Tp epsilon() throw() { return static_cast<_Tp>(0); }
643 static _Tp round_error() throw() { return static_cast<_Tp>(0); }
54c1bf78
BK
644 static _Tp infinity() throw() { return static_cast<_Tp>(0); }
645 static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }
646 static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }
647 static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }
54c1bf78
BK
648 };
649
54c1bf78 650 // Now there follow 15 explicit specializations. Yes, 15. Make sure
84979344 651 // you get the count right.
54c1bf78
BK
652 template<>
653 struct numeric_limits<bool>
654 {
655 static const bool is_specialized = true;
656
657 static bool min() throw()
658 { return false; }
659
660 static bool max() throw()
661 { return true; }
662
663 static const int digits = __glibcpp_bool_digits;
664 static const int digits10 = 0;
665 static const bool is_signed = false;
666 static const bool is_integer = true;
667 static const bool is_exact = true;
668 static const int radix = 2;
669 static bool epsilon() throw()
670 { return false; }
671 static bool round_error() throw()
672 { return false; }
673
674 static const int min_exponent = 0;
675 static const int min_exponent10 = 0;
676 static const int max_exponent = 0;
677 static const int max_exponent10 = 0;
678
679 static const bool has_infinity = false;
680 static const bool has_quiet_NaN = false;
681 static const bool has_signaling_NaN = false;
682 static const float_denorm_style has_denorm = denorm_absent;
683 static const bool has_denorm_loss = false;
684
685 static bool infinity() throw()
686 { return false; }
687 static bool quiet_NaN() throw()
688 { return false; }
689 static bool signaling_NaN() throw()
690 { return false; }
691 static bool denorm_min() throw()
692 { return false; }
693
a9bb75a7 694 static const bool is_iec559 = false;
54c1bf78 695 static const bool is_bounded = true;
a9bb75a7 696 static const bool is_modulo = false;
54c1bf78
BK
697
698 // It is not clear what it means for a boolean type to trap.
699 // This is a DR on the LWG issue list. Here, I use integer
700 // promotion semantics.
701 static const bool traps = __glibcpp_signed_int_traps
702 || __glibcpp_signed_long_traps;
703 static const bool tinyness_before = false;
704 static const float_round_style round_style = round_toward_zero;
705 };
706
707#undef __glibcpp_bool_digits
708
709 template<>
710 struct numeric_limits<char>
711 {
712 static const bool is_specialized = true;
713
714 static char min() throw()
715 { return __glibcpp_char_min; }
716 static char max() throw()
717 { return __glibcpp_char_max; }
718
719 static const int digits = __glibcpp_char_digits;
720 static const int digits10 = __glibcpp_char_digits10;
721 static const bool is_signed = __glibcpp_plain_char_is_signed;
722 static const bool is_integer = true;
723 static const bool is_exact = true;
724 static const int radix = 2;
725 static char epsilon() throw()
be71ea9d 726 { return 0; }
54c1bf78 727 static char round_error() throw()
be71ea9d 728 { return 0; }
54c1bf78
BK
729
730 static const int min_exponent = 0;
731 static const int min_exponent10 = 0;
732 static const int max_exponent = 0;
733 static const int max_exponent10 = 0;
734
735 static const bool has_infinity = false;
736 static const bool has_quiet_NaN = false;
737 static const bool has_signaling_NaN = false;
738 static const float_denorm_style has_denorm = denorm_absent;
739 static const bool has_denorm_loss = false;
740
741 static char infinity() throw()
742 { return char(); }
743 static char quiet_NaN() throw()
744 { return char(); }
745 static char signaling_NaN() throw()
746 { return char(); }
747 static char denorm_min() throw()
748 { return static_cast<char>(0); }
749
750 static const bool is_iec559 = false;
751 static const bool is_bounded = true;
752 static const bool is_modulo = __glibcpp_char_is_modulo;
753
754 static const bool traps = __glibcpp_char_traps;
755 static const bool tinyness_before = false;
756 static const float_round_style round_style = round_toward_zero;
757 };
758
759#undef __glibcpp_char_min
760#undef __glibcpp_char_max
761#undef __glibcpp_char_digits
762#undef __glibcpp_char_digits10
763#undef __glibcpp_char_is_signed
764#undef __glibcpp_char_is_modulo
765#undef __glibcpp_char_traps
766
767
768
769 template<>
770 struct numeric_limits<signed char>
771 {
772 static const bool is_specialized = true;
773
774 static signed char min() throw()
775 { return __glibcpp_signed_char_min; }
776 static signed char max() throw()
777 { return __glibcpp_signed_char_max; }
778
779 static const int digits = __glibcpp_signed_char_digits;
780 static const int digits10 = __glibcpp_signed_char_digits10;
781 static const bool is_signed = true;
782 static const bool is_integer = true;
783 static const bool is_exact = true;
784 static const int radix = 2;
785 static signed char epsilon() throw()
786 { return 0; }
787 static signed char round_error() throw()
788 { return 0; }
789
790 static const int min_exponent = 0;
791 static const int min_exponent10 = 0;
792 static const int max_exponent = 0;
793 static const int max_exponent10 = 0;
794
795 static const bool has_infinity = false;
796 static const bool has_quiet_NaN = false;
797 static const bool has_signaling_NaN = false;
798 static const float_denorm_style has_denorm = denorm_absent;
799 static const bool has_denorm_loss = false;
800
801 static signed char infinity() throw()
802 { return static_cast<signed char>(0); }
803 static signed char quiet_NaN() throw()
804 { return static_cast<signed char>(0); }
805 static signed char signaling_NaN() throw()
806 { return static_cast<signed char>(0); }
807 static signed char denorm_min() throw()
808 { return static_cast<signed char>(0); }
809
810 static const bool is_iec559 = false;
811 static const bool is_bounded = true;
812 static const bool is_modulo = __glibcpp_signed_char_is_modulo;
813
814 static const bool traps = __glibcpp_signed_char_traps;
815 static const bool tinyness_before = false;
816 static const float_round_style round_style = round_toward_zero;
817 };
818
819#undef __glibcpp_signed_char_min
820#undef __glibcpp_signed_char_max
821#undef __glibcpp_signed_char_digits
822#undef __glibcpp_signed_char_digits10
823#undef __glibcpp_signed_char_is_modulo
824#undef __glibcpp_signed_char_traps
825
826 template<>
827 struct numeric_limits<unsigned char>
828 {
829 static const bool is_specialized = true;
830
831 static unsigned char min() throw()
832 { return 0; }
833 static unsigned char max() throw()
834 { return __glibcpp_unsigned_char_max; }
835
836 static const int digits = __glibcpp_unsigned_char_digits;
837 static const int digits10 = __glibcpp_unsigned_char_digits10;
838 static const bool is_signed = false;
839 static const bool is_integer = true;
840 static const bool is_exact = true;
841 static const int radix = 2;
842 static unsigned char epsilon() throw()
843 { return 0; }
844 static unsigned char round_error() throw()
845 { return 0; }
846
847 static const int min_exponent = 0;
848 static const int min_exponent10 = 0;
849 static const int max_exponent = 0;
850 static const int max_exponent10 = 0;
851
852 static const bool has_infinity = false;
853 static const bool has_quiet_NaN = false;
854 static const bool has_signaling_NaN = false;
855 static const float_denorm_style has_denorm = denorm_absent;
856 static const bool has_denorm_loss = false;
857
858 static unsigned char infinity() throw()
859 { return static_cast<unsigned char>(0); }
860 static unsigned char quiet_NaN() throw()
861 { return static_cast<unsigned char>(0); }
862 static unsigned char signaling_NaN() throw()
863 { return static_cast<unsigned char>(0); }
864 static unsigned char denorm_min() throw()
865 { return static_cast<unsigned char>(0); }
866
867 static const bool is_iec559 = false;
868 static const bool is_bounded = true;
869 static const bool is_modulo = true;
870
871 static const bool traps = __glibcpp_unsigned_char_traps;
872 static const bool tinyness_before = false;
873 static const float_round_style round_style = round_toward_zero;
874 };
875
876#undef __glibcpp_unsigned_char_max
877#undef __glibcpp_unsigned_char_digits
878#undef __glibcpp_unsigned_char_digits10
879#undef __glibcpp_unsigned_char_traps
880
881 template<>
882 struct numeric_limits<wchar_t>
883 {
884 static const bool is_specialized = true;
885
886 static wchar_t min() throw()
887 { return __glibcpp_wchar_t_min; }
888 static wchar_t max() throw()
889 { return __glibcpp_wchar_t_max; }
890
891 static const int digits = __glibcpp_wchar_t_digits;
892 static const int digits10 = __glibcpp_wchar_t_digits10;
893 static const bool is_signed = __glibcpp_wchar_t_is_signed;
894 static const bool is_integer = true;
895 static const bool is_exact = true;
896 static const int radix = 2;
897 static wchar_t epsilon() throw()
898 { return 0; }
899 static wchar_t round_error() throw()
900 { return 0; }
901
902 static const int min_exponent = 0;
903 static const int min_exponent10 = 0;
904 static const int max_exponent = 0;
905 static const int max_exponent10 = 0;
906
907 static const bool has_infinity = false;
908 static const bool has_quiet_NaN = false;
909 static const bool has_signaling_NaN = false;
910 static const float_denorm_style has_denorm = denorm_absent;
911 static const bool has_denorm_loss = false;
912
913 static wchar_t infinity() throw()
914 { return wchar_t(); }
915 static wchar_t quiet_NaN() throw()
916 { return wchar_t(); }
917 static wchar_t signaling_NaN() throw()
918 { return wchar_t(); }
919 static wchar_t denorm_min() throw()
920 { return wchar_t(); }
921
922 static const bool is_iec559 = false;
923 static const bool is_bounded = true;
924 static const bool is_modulo = __glibcpp_wchar_t_is_modulo;
925
926 static const bool traps = __glibcpp_wchar_t_traps;
927 static const bool tinyness_before = false;
928 static const float_round_style round_style = round_toward_zero;
929 };
930
931#undef __glibcpp_wchar_t_min
932#undef __glibcpp_wchar_t_max
933#undef __glibcpp_wchar_t_digits
934#undef __glibcpp_wchar_t_digits10
935#undef __glibcpp_wchar_t_is_signed
936#undef __glibcpp_wchar_t_is_modulo
937#undef __glibcpp_wchar_t_traps
938
939 template<>
940 struct numeric_limits<short>
941 {
942 static const bool is_specialized = true;
943
944 static short min() throw()
945 { return __glibcpp_signed_short_min; }
946 static short max() throw()
947 { return __glibcpp_signed_short_max; }
948
949 static const int digits = __glibcpp_signed_short_digits;
950 static const int digits10 = __glibcpp_signed_short_digits10;
951 static const bool is_signed = true;
952 static const bool is_integer = true;
953 static const bool is_exact = true;
954 static const int radix = 2;
955 static short epsilon() throw()
956 { return 0; }
957 static short round_error() throw()
958 { return 0; }
959
960 static const int min_exponent = 0;
961 static const int min_exponent10 = 0;
962 static const int max_exponent = 0;
963 static const int max_exponent10 = 0;
964
965 static const bool has_infinity = false;
966 static const bool has_quiet_NaN = false;
967 static const bool has_signaling_NaN = false;
968 static const float_denorm_style has_denorm = denorm_absent;
969 static const bool has_denorm_loss = false;
970
971 static short infinity() throw()
972 { return short(); }
973 static short quiet_NaN() throw()
974 { return short(); }
975 static short signaling_NaN() throw()
976 { return short(); }
977 static short denorm_min() throw()
978 { return short(); }
979
980 static const bool is_iec559 = true;
981 static const bool is_bounded = true;
982 static const bool is_modulo = __glibcpp_signed_short_is_modulo;
983
984 static const bool traps = __glibcpp_signed_short_traps;
985 static const bool tinyness_before = false;
986 static const float_round_style round_style = round_toward_zero;
987 };
988
989#undef __glibcpp_signed_short_min
990#undef __glibcpp_signed_short_max
991#undef __glibcpp_signed_short_digits
992#undef __glibcpp_signed_short_digits10
993#undef __glibcpp_signed_short_is_modulo
994#undef __glibcpp_signed_short_traps
995
996 template<>
997 struct numeric_limits<unsigned short>
998 {
999 static const bool is_specialized = true;
1000
1001 static unsigned short min() throw()
1002 { return 0; }
1003 static unsigned short max() throw()
1004 { return __glibcpp_unsigned_short_max; }
1005
1006 static const int digits = __glibcpp_unsigned_short_digits;
1007 static const int digits10 = __glibcpp_unsigned_short_digits10;
1008 static const bool is_signed = false;
1009 static const bool is_integer = true;
1010 static const bool is_exact = true;
1011 static const int radix = 2;
1012 static unsigned short epsilon() throw()
1013 { return 0; }
1014 static unsigned short round_error() throw()
1015 { return 0; }
1016
1017 static const int min_exponent = 0;
1018 static const int min_exponent10 = 0;
1019 static const int max_exponent = 0;
1020 static const int max_exponent10 = 0;
1021
1022 static const bool has_infinity = false;
1023 static const bool has_quiet_NaN = false;
1024 static const bool has_signaling_NaN = false;
1025 static const float_denorm_style has_denorm = denorm_absent;
1026 static const bool has_denorm_loss = false;
1027
1028 static unsigned short infinity() throw()
1029 { return static_cast<unsigned short>(0); }
1030 static unsigned short quiet_NaN() throw()
1031 { return static_cast<unsigned short>(0); }
1032 static unsigned short signaling_NaN() throw()
1033 { return static_cast<unsigned short>(0); }
1034 static unsigned short denorm_min() throw()
1035 { return static_cast<unsigned short>(0); }
1036
1037 static const bool is_iec559 = true;
1038 static const bool is_bounded = true;
1039 static const bool is_modulo = true;
1040
1041 static const bool traps = __glibcpp_unsigned_short_traps;
1042 static const bool tinyness_before = false;
1043 static const float_round_style round_style = round_toward_zero;
1044 };
1045
1046#undef __glibcpp_unsigned_short_max
1047#undef __glibcpp_unsigned_short_digits
1048#undef __glibcpp_unsigned_short_digits10
1049#undef __glibcpp_unsigned_short_traps
1050
1051 template<>
1052 struct numeric_limits<int>
1053 {
1054 static const bool is_specialized = true;
1055
1056 static int min() throw()
1057 { return __glibcpp_signed_int_min; }
1058 static int max() throw()
1059 { return __glibcpp_signed_int_max; }
1060
1061 static const int digits = __glibcpp_signed_int_digits;
1062 static const int digits10 = __glibcpp_signed_int_digits10;
1063 static const bool is_signed = true;
1064 static const bool is_integer = true;
1065 static const bool is_exact = true;
1066 static const int radix = 2;
1067 static int epsilon() throw()
1068 { return 0; }
1069 static int round_error() throw()
1070 { return 0; }
1071
1072 static const int min_exponent = 0;
1073 static const int min_exponent10 = 0;
1074 static const int max_exponent = 0;
1075 static const int max_exponent10 = 0;
1076
1077 static const bool has_infinity = false;
1078 static const bool has_quiet_NaN = false;
1079 static const bool has_signaling_NaN = false;
1080 static const float_denorm_style has_denorm = denorm_absent;
1081 static const bool has_denorm_loss = false;
1082
1083 static int infinity() throw()
1084 { return static_cast<int>(0); }
1085 static int quiet_NaN() throw()
1086 { return static_cast<int>(0); }
1087 static int signaling_NaN() throw()
1088 { return static_cast<int>(0); }
1089 static int denorm_min() throw()
1090 { return static_cast<int>(0); }
1091
1092 static const bool is_iec559 = true;
1093 static const bool is_bounded = true;
1094 static const bool is_modulo = __glibcpp_signed_int_is_modulo;
1095
1096 static const bool traps = __glibcpp_signed_int_traps;
1097 static const bool tinyness_before = false;
1098 static const float_round_style round_style = round_toward_zero;
1099 };
1100
1101#undef __glibcpp_signed_int_min
1102#undef __glibcpp_signed_int_max
1103#undef __glibcpp_signed_int_digits
1104#undef __glibcpp_signed_int_digits10
1105#undef __glibcpp_signed_int_is_modulo
1106#undef __glibcpp_signed_int_traps
1107
1108 template<>
1109 struct numeric_limits<unsigned int>
1110 {
1111 static const bool is_specialized = true;
1112
1113 static unsigned int min() throw()
1114 { return 0; }
1115 static unsigned int max() throw()
1116 { return __glibcpp_unsigned_int_max; }
1117
1118 static const int digits = __glibcpp_unsigned_int_digits;
1119 static const int digits10 = __glibcpp_unsigned_int_digits10;
1120 static const bool is_signed = false;
1121 static const bool is_integer = true;
1122 static const bool is_exact = true;
1123 static const int radix = 2;
1124 static unsigned int epsilon() throw()
1125 { return 0; }
1126 static unsigned int round_error() throw()
1127 { return 0; }
1128
1129 static const int min_exponent = 0;
1130 static const int min_exponent10 = 0;
1131 static const int max_exponent = 0;
1132 static const int max_exponent10 = 0;
1133
1134 static const bool has_infinity = false;
1135 static const bool has_quiet_NaN = false;
1136 static const bool has_signaling_NaN = false;
1137 static const float_denorm_style has_denorm = denorm_absent;
1138 static const bool has_denorm_loss = false;
1139
1140 static unsigned int infinity() throw()
1141 { return static_cast<unsigned int>(0); }
1142 static unsigned int quiet_NaN() throw()
1143 { return static_cast<unsigned int>(0); }
1144 static unsigned int signaling_NaN() throw()
1145 { return static_cast<unsigned int>(0); }
1146 static unsigned int denorm_min() throw()
1147 { return static_cast<unsigned int>(0); }
1148
1149 static const bool is_iec559 = true;
1150 static const bool is_bounded = true;
1151 static const bool is_modulo = true;
1152
1153 static const bool traps = __glibcpp_unsigned_int_traps;
1154 static const bool tinyness_before = false;
1155 static const float_round_style round_style = round_toward_zero;
1156 };
1157
1158#undef __glibcpp_unsigned_int_max
1159#undef __glibcpp_unsigned_int_digits
1160#undef __glibcpp_unsigned_int_digits10
1161#undef __glibcpp_unsigned_int_traps
1162
1163 template<>
1164 struct numeric_limits<long>
1165 {
1166 static const bool is_specialized = true;
1167
1168 static long min() throw()
1169 { return __glibcpp_signed_long_min; }
1170 static long max() throw()
1171 { return __glibcpp_signed_long_max; }
1172
1173 static const int digits = __glibcpp_signed_long_digits;
1174 static const int digits10 = __glibcpp_signed_long_digits10;
1175 static const bool is_signed = true;
1176 static const bool is_integer = true;
1177 static const bool is_exact = true;
1178 static const int radix = 2;
1179 static long epsilon() throw()
1180 { return 0; }
1181 static long round_error() throw()
1182 { return 0; }
1183
1184 static const int min_exponent = 0;
1185 static const int min_exponent10 = 0;
1186 static const int max_exponent = 0;
1187 static const int max_exponent10 = 0;
1188
1189 static const bool has_infinity = false;
1190 static const bool has_quiet_NaN = false;
1191 static const bool has_signaling_NaN = false;
1192 static const float_denorm_style has_denorm = denorm_absent;
1193 static const bool has_denorm_loss = false;
1194
1195 static long infinity() throw()
1196 { return static_cast<long>(0); }
1197 static long quiet_NaN() throw()
1198 { return static_cast<long>(0); }
1199 static long signaling_NaN() throw()
1200 { return static_cast<long>(0); }
1201 static long denorm_min() throw()
1202 { return static_cast<long>(0); }
1203
1204 static const bool is_iec559 = true;
1205 static const bool is_bounded = true;
1206 static const bool is_modulo = __glibcpp_signed_long_is_modulo;
1207
1208 static const bool traps = __glibcpp_signed_long_traps;
1209 static const bool tinyness_before = false;
1210 static const float_round_style round_style = round_toward_zero;
1211 };
1212
1213#undef __glibcpp_signed_long_min
1214#undef __glibcpp_signed_long_max
1215#undef __glibcpp_signed_long_digits
1216#undef __glibcpp_signed_long_digits10
1217#undef __glibcpp_signed_long_is_modulo
1218#undef __glibcpp_signed_long_traps
1219
1220 template<>
1221 struct numeric_limits<unsigned long>
1222 {
1223 static const bool is_specialized = true;
1224
1225 static unsigned long min() throw()
1226 { return 0; }
1227 static unsigned long max() throw()
1228 { return __glibcpp_unsigned_long_max; }
1229
1230 static const int digits = __glibcpp_unsigned_long_digits;
1231 static const int digits10 = __glibcpp_unsigned_long_digits10;
1232 static const bool is_signed = false;
1233 static const bool is_integer = true;
1234 static const bool is_exact = true;
1235 static const int radix = 2;
1236 static unsigned long epsilon() throw()
1237 { return 0; }
1238 static unsigned long round_error() throw()
1239 { return 0; }
1240
1241 static const int min_exponent = 0;
1242 static const int min_exponent10 = 0;
1243 static const int max_exponent = 0;
1244 static const int max_exponent10 = 0;
1245
1246 static const bool has_infinity = false;
1247 static const bool has_quiet_NaN = false;
1248 static const bool has_signaling_NaN = false;
1249 static const float_denorm_style has_denorm = denorm_absent;
1250 static const bool has_denorm_loss = false;
1251
1252 static unsigned long infinity() throw()
1253 { return static_cast<unsigned long>(0); }
1254 static unsigned long quiet_NaN() throw()
1255 { return static_cast<unsigned long>(0); }
1256 static unsigned long signaling_NaN() throw()
1257 { return static_cast<unsigned long>(0); }
1258 static unsigned long denorm_min() throw()
1259 { return static_cast<unsigned long>(0); }
1260
1261 static const bool is_iec559 = true;
1262 static const bool is_bounded = true;
1263 static const bool is_modulo = true;
1264
1265 static const bool traps = __glibcpp_unsigned_long_traps;
1266 static const bool tinyness_before = false;
1267 static const float_round_style round_style = round_toward_zero;
1268 };
1269
1270#undef __glibcpp_unsigned_long_max
1271#undef __glibcpp_unsigned_long_digits
1272#undef __glibcpp_unsigned_long_digits10
1273#undef __glibcpp_unsigned_long_traps
1274
1275 template<>
1276 struct numeric_limits<long long>
1277 {
1278 static const bool is_specialized = true;
1279
1280 static long long min() throw()
1281 { return __glibcpp_signed_long_long_min; }
1282 static long long max() throw()
1283 { return __glibcpp_signed_long_long_max; }
1284
1285 static const int digits = __glibcpp_signed_long_long_digits;
1286 static const int digits10 = __glibcpp_signed_long_long_digits10;
1287 static const bool is_signed = true;
1288 static const bool is_integer = true;
1289 static const bool is_exact = true;
1290 static const int radix = 2;
1291 static long long epsilon() throw()
1292 { return 0; }
1293 static long long round_error() throw()
1294 { return 0; }
1295
1296 static const int min_exponent = 0;
1297 static const int min_exponent10 = 0;
1298 static const int max_exponent = 0;
1299 static const int max_exponent10 = 0;
1300
1301 static const bool has_infinity = false;
1302 static const bool has_quiet_NaN = false;
1303 static const bool has_signaling_NaN = false;
1304 static const float_denorm_style has_denorm = denorm_absent;
1305 static const bool has_denorm_loss = false;
1306
1307 static long long infinity() throw()
1308 { return static_cast<long long>(0); }
1309 static long long quiet_NaN() throw()
1310 { return static_cast<long long>(0); }
1311 static long long signaling_NaN() throw()
1312 { return static_cast<long long>(0); }
1313 static long long denorm_min() throw()
1314 { return static_cast<long long>(0); }
1315
1316 static const bool is_iec559 = true;
1317 static const bool is_bounded = true;
1318 static const bool is_modulo = __glibcpp_signed_long_long_is_modulo;
1319
1320 static const bool traps = __glibcpp_signed_long_long_traps;
1321 static const bool tinyness_before = false;
1322 static const float_round_style round_style = round_toward_zero;
1323 };
1324
1325#undef __glibcpp_signed_long_long_min
1326#undef __glibcpp_signed_long_long_max
1327#undef __glibcpp_signed_long_long_digits
1328#undef __glibcpp_signed_long_long_digits10
1329#undef __glibcpp_signed_long_long_is_modulo
1330#undef __glibcpp_signed_long_long_traps
1331
1332 template<>
1333 struct numeric_limits<unsigned long long>
1334 {
1335 static const bool is_specialized = true;
1336
1337 static unsigned long long min() throw()
1338 { return 0; }
1339 static unsigned long long max() throw()
1340 { return __glibcpp_unsigned_long_long_max; }
1341
1342 static const int digits = __glibcpp_unsigned_long_long_digits;
1343 static const int digits10 = __glibcpp_unsigned_long_long_digits10;
1344 static const bool is_signed = false;
1345 static const bool is_integer = true;
1346 static const bool is_exact = true;
1347 static const int radix = 2;
1348 static unsigned long long epsilon() throw()
1349 { return 0; }
1350 static unsigned long long round_error() throw()
1351 { return 0; }
1352
1353 static const int min_exponent = 0;
1354 static const int min_exponent10 = 0;
1355 static const int max_exponent = 0;
1356 static const int max_exponent10 = 0;
1357
1358 static const bool has_infinity = false;
1359 static const bool has_quiet_NaN = false;
1360 static const bool has_signaling_NaN = false;
1361 static const float_denorm_style has_denorm = denorm_absent;
1362 static const bool has_denorm_loss = false;
1363
1364 static unsigned long long infinity() throw()
1365 { return static_cast<unsigned long long>(0); }
1366 static unsigned long long quiet_NaN() throw()
1367 { return static_cast<unsigned long long>(0); }
1368 static unsigned long long signaling_NaN() throw()
1369 { return static_cast<unsigned long long>(0); }
1370 static unsigned long long denorm_min() throw()
1371 { return static_cast<unsigned long long>(0); }
1372
1373 static const bool is_iec559 = true;
1374 static const bool is_bounded = true;
1375 static const bool is_modulo = true;
1376
1377 static const bool traps = true;
1378 static const bool tinyness_before = false;
1379 static const float_round_style round_style = round_toward_zero;
1380 };
1381
1382#undef __glibcpp_unsigned_long_long_max
1383#undef __glibcpp_unsigned_long_long_digits
1384#undef __glibcpp_unsigned_long_long_digits10
1385#undef __glibcpp_unsigned_long_long_traps
1386
1387 template<>
1388 struct numeric_limits<float>
1389 {
1390 static const bool is_specialized = true;
1391
1392 static float min() throw()
5e25fa22 1393 { return __FLT_MIN__; }
54c1bf78 1394 static float max() throw()
5e25fa22 1395 { return __FLT_MAX__; }
54c1bf78 1396
5e25fa22
RH
1397 static const int digits = __FLT_MANT_DIG__;
1398 static const int digits10 = __FLT_DIG__;
54c1bf78
BK
1399 static const bool is_signed = true;
1400 static const bool is_integer = false;
1401 static const bool is_exact = false;
5e25fa22 1402 static const int radix = __FLT_RADIX__;
54c1bf78 1403 static float epsilon() throw()
5e25fa22 1404 { return __FLT_EPSILON__; }
54c1bf78 1405 static float round_error() throw()
be71ea9d 1406 { return 0.5F; }
54c1bf78 1407
5e25fa22
RH
1408 static const int min_exponent = __FLT_MIN_EXP__;
1409 static const int min_exponent10 = __FLT_MIN_10_EXP__;
1410 static const int max_exponent = __FLT_MAX_EXP__;
1411 static const int max_exponent10 = __FLT_MAX_10_EXP__;
54c1bf78 1412
65e32b88
RH
1413 static const bool has_infinity
1414 = __builtin_huge_valf () / 2 == __builtin_huge_valf ();
1472e41c
RH
1415 static const bool has_quiet_NaN
1416 = __builtin_nanf ("") != __builtin_nanf ("");
1417 static const bool has_signaling_NaN = has_quiet_NaN;
ac520ec9
RH
1418 static const float_denorm_style has_denorm
1419 = __FLT_DENORM_MIN__ ? denorm_present : denorm_absent;
54c1bf78
BK
1420 static const bool has_denorm_loss = __glibcpp_float_has_denorm_loss;
1421
1422 static float infinity() throw()
65e32b88 1423 { return __builtin_huge_valf (); }
54c1bf78 1424 static float quiet_NaN() throw()
1472e41c 1425 { return __builtin_nanf (""); }
54c1bf78 1426 static float signaling_NaN() throw()
1472e41c 1427 { return __builtin_nansf (""); }
54c1bf78 1428 static float denorm_min() throw()
ac520ec9 1429 { return __FLT_DENORM_MIN__; }
54c1bf78 1430
cf2214db 1431 static const bool is_iec559 = has_infinity && has_quiet_NaN;
54c1bf78
BK
1432 static const bool is_bounded = __glibcpp_float_is_bounded;
1433 static const bool is_modulo = __glibcpp_float_is_modulo;
1434
1435 static const bool traps = __glibcpp_float_traps;
1436 static const bool tinyness_before = __glibcpp_float_tinyness_before;
be71ea9d 1437 static const float_round_style round_style = round_to_nearest;
54c1bf78
BK
1438 };
1439
54c1bf78 1440#undef __glibcpp_float_has_denorm_loss
54c1bf78
BK
1441#undef __glibcpp_float_is_bounded
1442#undef __glibcpp_float_is_modulo
1443#undef __glibcpp_float_traps
1444#undef __glibcpp_float_tinyness_before
54c1bf78
BK
1445
1446 template<>
1447 struct numeric_limits<double>
1448 {
1449 static const bool is_specialized = true;
1450
1451 static double min() throw()
5e25fa22 1452 { return __DBL_MIN__; }
54c1bf78 1453 static double max() throw()
5e25fa22 1454 { return __DBL_MAX__; }
54c1bf78 1455
5e25fa22
RH
1456 static const int digits = __DBL_MANT_DIG__;
1457 static const int digits10 = __DBL_DIG__;
54c1bf78
BK
1458 static const bool is_signed = true;
1459 static const bool is_integer = false;
1460 static const bool is_exact = false;
5e25fa22 1461 static const int radix = __FLT_RADIX__;
54c1bf78 1462 static double epsilon() throw()
5e25fa22 1463 { return __DBL_EPSILON__; }
54c1bf78 1464 static double round_error() throw()
be71ea9d 1465 { return 0.5; }
54c1bf78 1466
5e25fa22
RH
1467 static const int min_exponent = __DBL_MIN_EXP__;
1468 static const int min_exponent10 = __DBL_MIN_10_EXP__;
1469 static const int max_exponent = __DBL_MAX_EXP__;
1470 static const int max_exponent10 = __DBL_MAX_10_EXP__;
54c1bf78 1471
65e32b88
RH
1472 static const bool has_infinity
1473 = __builtin_huge_val () / 2 == __builtin_huge_val ();
1472e41c
RH
1474 static const bool has_quiet_NaN
1475 = __builtin_nan ("") != __builtin_nan ("");
1476 static const bool has_signaling_NaN = has_quiet_NaN;
ac520ec9
RH
1477 static const float_denorm_style has_denorm
1478 = __DBL_DENORM_MIN__ ? denorm_present : denorm_absent;
54c1bf78
BK
1479 static const bool has_denorm_loss = __glibcpp_double_has_denorm_loss;
1480
1481 static double infinity() throw()
65e32b88 1482 { return __builtin_huge_val(); }
54c1bf78 1483 static double quiet_NaN() throw()
1472e41c 1484 { return __builtin_nan (""); }
54c1bf78 1485 static double signaling_NaN() throw()
1472e41c 1486 { return __builtin_nans (""); }
54c1bf78 1487 static double denorm_min() throw()
ac520ec9 1488 { return __DBL_DENORM_MIN__; }
54c1bf78 1489
cf2214db 1490 static const bool is_iec559 = has_infinity && has_quiet_NaN;
54c1bf78
BK
1491 static const bool is_bounded = __glibcpp_double_is_bounded;
1492 static const bool is_modulo = __glibcpp_double_is_modulo;
1493
1494 static const bool traps = __glibcpp_double_traps;
1495 static const bool tinyness_before = __glibcpp_double_tinyness_before;
be71ea9d 1496 static const float_round_style round_style = round_to_nearest;
54c1bf78
BK
1497 };
1498
54c1bf78 1499#undef __glibcpp_double_has_denorm_loss
54c1bf78
BK
1500#undef __glibcpp_double_is_bounded
1501#undef __glibcpp_double_is_modulo
1502#undef __glibcpp_double_traps
1503#undef __glibcpp_double_tinyness_before
54c1bf78
BK
1504
1505
1506 template<>
1507 struct numeric_limits<long double>
1508 {
1509 static const bool is_specialized = true;
1510
1511 static long double min() throw()
5e25fa22 1512 { return __LDBL_MIN__; }
54c1bf78 1513 static long double max() throw()
5e25fa22 1514 { return __LDBL_MAX__; }
54c1bf78 1515
5e25fa22
RH
1516 static const int digits = __LDBL_MANT_DIG__;
1517 static const int digits10 = __LDBL_DIG__;
54c1bf78
BK
1518 static const bool is_signed = true;
1519 static const bool is_integer = false;
1520 static const bool is_exact = false;
5e25fa22 1521 static const int radix = __FLT_RADIX__;
54c1bf78 1522 static long double epsilon() throw()
5e25fa22 1523 { return __LDBL_EPSILON__; }
54c1bf78 1524 static long double round_error() throw()
be71ea9d 1525 { return 0.5L; }
54c1bf78 1526
5e25fa22
RH
1527 static const int min_exponent = __LDBL_MIN_EXP__;
1528 static const int min_exponent10 = __LDBL_MIN_10_EXP__;
1529 static const int max_exponent = __LDBL_MAX_EXP__;
1530 static const int max_exponent10 = __LDBL_MAX_10_EXP__;
54c1bf78 1531
65e32b88
RH
1532 static const bool has_infinity
1533 = __builtin_huge_vall () / 2 == __builtin_huge_vall ();
1472e41c
RH
1534 static const bool has_quiet_NaN
1535 = __builtin_nanl ("") != __builtin_nanl ("");
1536 static const bool has_signaling_NaN = has_quiet_NaN;
ac520ec9
RH
1537 static const float_denorm_style has_denorm
1538 = __LDBL_DENORM_MIN__ ? denorm_present : denorm_absent;
1539 static const bool has_denorm_loss
1540 = __glibcpp_long_double_has_denorm_loss;
54c1bf78
BK
1541
1542 static long double infinity() throw()
65e32b88 1543 { return __builtin_huge_vall (); }
54c1bf78 1544 static long double quiet_NaN() throw()
1472e41c 1545 { return __builtin_nanl (""); }
54c1bf78 1546 static long double signaling_NaN() throw()
1472e41c 1547 { return __builtin_nansl (""); }
54c1bf78 1548 static long double denorm_min() throw()
ac520ec9 1549 { return __LDBL_DENORM_MIN__; }
54c1bf78 1550
cf2214db 1551 static const bool is_iec559 = has_infinity && has_quiet_NaN;
54c1bf78
BK
1552 static const bool is_bounded = __glibcpp_long_double_is_bounded;
1553 static const bool is_modulo = __glibcpp_long_double_is_modulo;
1554
1555 static const bool traps = __glibcpp_long_double_traps;
1556 static const bool tinyness_before = __glibcpp_long_double_tinyness_before;
be71ea9d 1557 static const float_round_style round_style = round_to_nearest;
54c1bf78
BK
1558 };
1559
54c1bf78 1560#undef __glibcpp_long_double_has_denorm_loss
54c1bf78
BK
1561#undef __glibcpp_long_double_is_bounded
1562#undef __glibcpp_long_double_is_modulo
1563#undef __glibcpp_long_double_traps
1564#undef __glibcpp_long_double_tinyness_before
be71ea9d 1565
54c1bf78
BK
1566} // namespace std
1567
1568#endif // _CPP_NUMERIC_LIMITS