c52c500ebd725d49164bd9b5a4f3969e4986f81b
[debian/tar] / gnu / float.in.h
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A correct <float.h>.
4
5    Copyright (C) 2007-2013 Free Software Foundation, Inc.
6
7    This program is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
20 #ifndef _@GUARD_PREFIX@_FLOAT_H
21
22 #if __GNUC__ >= 3
23 @PRAGMA_SYSTEM_HEADER@
24 #endif
25 @PRAGMA_COLUMNS@
26
27 /* The include_next requires a split double-inclusion guard.  */
28 #@INCLUDE_NEXT@ @NEXT_FLOAT_H@
29
30 #ifndef _@GUARD_PREFIX@_FLOAT_H
31 #define _@GUARD_PREFIX@_FLOAT_H
32
33 /* 'long double' properties.  */
34
35 #if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
36 /* Number of mantissa units, in base FLT_RADIX.  */
37 # undef LDBL_MANT_DIG
38 # define LDBL_MANT_DIG   64
39 /* Number of decimal digits that is sufficient for representing a number.  */
40 # undef LDBL_DIG
41 # define LDBL_DIG        18
42 /* x-1 where x is the smallest representable number > 1.  */
43 # undef LDBL_EPSILON
44 # define LDBL_EPSILON    1.0842021724855044340E-19L
45 /* Minimum e such that FLT_RADIX^(e-1) is a normalized number.  */
46 # undef LDBL_MIN_EXP
47 # define LDBL_MIN_EXP    (-16381)
48 /* Maximum e such that FLT_RADIX^(e-1) is a representable finite number.  */
49 # undef LDBL_MAX_EXP
50 # define LDBL_MAX_EXP    16384
51 /* Minimum positive normalized number.  */
52 # undef LDBL_MIN
53 # define LDBL_MIN        3.3621031431120935063E-4932L
54 /* Maximum representable finite number.  */
55 # undef LDBL_MAX
56 # define LDBL_MAX        1.1897314953572317650E+4932L
57 /* Minimum e such that 10^e is in the range of normalized numbers.  */
58 # undef LDBL_MIN_10_EXP
59 # define LDBL_MIN_10_EXP (-4931)
60 /* Maximum e such that 10^e is in the range of representable finite numbers.  */
61 # undef LDBL_MAX_10_EXP
62 # define LDBL_MAX_10_EXP 4932
63 #endif
64
65 /* On FreeBSD/x86 6.4, the 'long double' type really has only 53 bits of
66    precision in the compiler but 64 bits of precision at runtime.  See
67    <http://lists.gnu.org/archive/html/bug-gnulib/2008-07/msg00063.html>.  */
68 #if defined __i386__ && defined __FreeBSD__
69 /* Number of mantissa units, in base FLT_RADIX.  */
70 # undef LDBL_MANT_DIG
71 # define LDBL_MANT_DIG   64
72 /* Number of decimal digits that is sufficient for representing a number.  */
73 # undef LDBL_DIG
74 # define LDBL_DIG        18
75 /* x-1 where x is the smallest representable number > 1.  */
76 # undef LDBL_EPSILON
77 # define LDBL_EPSILON 1.084202172485504434007452800869941711426e-19L /* 2^-63 */
78 /* Minimum e such that FLT_RADIX^(e-1) is a normalized number.  */
79 # undef LDBL_MIN_EXP
80 # define LDBL_MIN_EXP    (-16381)
81 /* Maximum e such that FLT_RADIX^(e-1) is a representable finite number.  */
82 # undef LDBL_MAX_EXP
83 # define LDBL_MAX_EXP    16384
84 /* Minimum positive normalized number.  */
85 # undef LDBL_MIN
86 # define LDBL_MIN        3.3621031431120935E-4932L /* = 0x1p-16382L */
87 /* Maximum representable finite number.  */
88 # undef LDBL_MAX
89 /* LDBL_MAX is represented as { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }.
90    But the largest literal that GCC allows us to write is
91    0x0.fffffffffffff8p16384L = { 0xFFFFF800, 0xFFFFFFFF, 32766 }.
92    So, define it like this through a reference to an external variable
93
94      const unsigned int LDBL_MAX[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 32766 };
95      extern const long double LDBL_MAX;
96
97    Unfortunately, this is not a constant expression.  */
98 union gl_long_double_union
99   {
100     struct { unsigned int lo; unsigned int hi; unsigned int exponent; } xd;
101     long double ld;
102   };
103 extern const union gl_long_double_union gl_LDBL_MAX;
104 # define LDBL_MAX (gl_LDBL_MAX.ld)
105 /* Minimum e such that 10^e is in the range of normalized numbers.  */
106 # undef LDBL_MIN_10_EXP
107 # define LDBL_MIN_10_EXP (-4931)
108 /* Maximum e such that 10^e is in the range of representable finite numbers.  */
109 # undef LDBL_MAX_10_EXP
110 # define LDBL_MAX_10_EXP 4932
111 #endif
112
113 /* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are
114    wrong.
115    On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong.  */
116 #if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__
117 # undef LDBL_MIN_EXP
118 # define LDBL_MIN_EXP DBL_MIN_EXP
119 # undef LDBL_MIN_10_EXP
120 # define LDBL_MIN_10_EXP DBL_MIN_10_EXP
121 # undef LDBL_MIN
122 # define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
123 #endif
124 #if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
125 # undef LDBL_MAX
126 /* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }.
127    It is not easy to define:
128      #define LDBL_MAX 1.79769313486231580793728971405302307166e308L
129    is too small, whereas
130      #define LDBL_MAX 1.79769313486231580793728971405302307167e308L
131    is too large.  Apparently a bug in GCC decimal-to-binary conversion.
132    Also, I can't get values larger than
133      #define LDBL63 ((long double) (1ULL << 63))
134      #define LDBL882 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
135      #define LDBL945 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
136      #define LDBL1008 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
137      #define LDBL_MAX (LDBL1008 * 65535.0L + LDBL945 * (long double) 9223372036821221375ULL + LDBL882 * (long double) 4611686018427387904ULL)
138    which is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xF8000000 }.
139    So, define it like this through a reference to an external variable
140
141      const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL };
142      extern const long double LDBL_MAX;
143
144    or through a pointer cast
145
146      #define LDBL_MAX \
147        (*(const long double *) (double[]) { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL })
148
149    Unfortunately, this is not a constant expression, and the latter expression
150    does not work well when GCC is optimizing..  */
151 union gl_long_double_union
152   {
153     struct { double hi; double lo; } dd;
154     long double ld;
155   };
156 extern const union gl_long_double_union gl_LDBL_MAX;
157 # define LDBL_MAX (gl_LDBL_MAX.ld)
158 #endif
159
160 /* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong.
161    On IRIX 6.5, with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_EPSILON
162    are wrong.  */
163 #if defined __sgi && (LDBL_MANT_DIG >= 106)
164 # undef LDBL_MANT_DIG
165 # define LDBL_MANT_DIG 106
166 # if defined __GNUC__
167 #  undef LDBL_MIN_EXP
168 #  define LDBL_MIN_EXP DBL_MIN_EXP
169 #  undef LDBL_MIN_10_EXP
170 #  define LDBL_MIN_10_EXP DBL_MIN_10_EXP
171 #  undef LDBL_MIN
172 #  define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
173 #  undef LDBL_EPSILON
174 #  define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */
175 # endif
176 #endif
177
178 #if @REPLACE_ITOLD@
179 /* Pull in a function that fixes the 'int' to 'long double' conversion
180    of glibc 2.7.  */
181 extern
182 # ifdef __cplusplus
183 "C"
184 # endif
185 void _Qp_itoq (long double *, int);
186 static void (*_gl_float_fix_itold) (long double *, int) = _Qp_itoq;
187 #endif
188
189 #endif /* _@GUARD_PREFIX@_FLOAT_H */
190 #endif /* _@GUARD_PREFIX@_FLOAT_H */