1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A correct <float.h>.
5 Copyright (C) 2007-2013 Free Software Foundation, Inc.
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.
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.
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/>. */
20 #ifndef _@GUARD_PREFIX@_FLOAT_H
23 @PRAGMA_SYSTEM_HEADER@
27 /* The include_next requires a split double-inclusion guard. */
28 #@INCLUDE_NEXT@ @NEXT_FLOAT_H@
30 #ifndef _@GUARD_PREFIX@_FLOAT_H
31 #define _@GUARD_PREFIX@_FLOAT_H
33 /* 'long double' properties. */
35 #if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
36 /* Number of mantissa units, in base FLT_RADIX. */
38 # define LDBL_MANT_DIG 64
39 /* Number of decimal digits that is sufficient for representing a number. */
42 /* x-1 where x is the smallest representable number > 1. */
44 # define LDBL_EPSILON 1.0842021724855044340E-19L
45 /* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */
47 # define LDBL_MIN_EXP (-16381)
48 /* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */
50 # define LDBL_MAX_EXP 16384
51 /* Minimum positive normalized number. */
53 # define LDBL_MIN 3.3621031431120935063E-4932L
54 /* Maximum representable finite number. */
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
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. */
71 # define LDBL_MANT_DIG 64
72 /* Number of decimal digits that is sufficient for representing a number. */
75 /* x-1 where x is the smallest representable number > 1. */
77 # define LDBL_EPSILON 1.084202172485504434007452800869941711426e-19L /* 2^-63 */
78 /* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */
80 # define LDBL_MIN_EXP (-16381)
81 /* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */
83 # define LDBL_MAX_EXP 16384
84 /* Minimum positive normalized number. */
86 # define LDBL_MIN 3.3621031431120935E-4932L /* = 0x1p-16382L */
87 /* Maximum representable finite number. */
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
94 const unsigned int LDBL_MAX[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 32766 };
95 extern const long double LDBL_MAX;
97 Unfortunately, this is not a constant expression. */
98 union gl_long_double_union
100 struct { unsigned int lo; unsigned int hi; unsigned int exponent; } xd;
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
113 /* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are
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__
118 # define LDBL_MIN_EXP DBL_MIN_EXP
119 # undef LDBL_MIN_10_EXP
120 # define LDBL_MIN_10_EXP DBL_MIN_10_EXP
122 # define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
124 #if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
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
141 const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL };
142 extern const long double LDBL_MAX;
144 or through a pointer cast
147 (*(const long double *) (double[]) { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL })
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
153 struct { double hi; double lo; } dd;
156 extern const union gl_long_double_union gl_LDBL_MAX;
157 # define LDBL_MAX (gl_LDBL_MAX.ld)
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
163 #if defined __sgi && (LDBL_MANT_DIG >= 106)
164 # undef LDBL_MANT_DIG
165 # define LDBL_MANT_DIG 106
166 # if defined __GNUC__
168 # define LDBL_MIN_EXP DBL_MIN_EXP
169 # undef LDBL_MIN_10_EXP
170 # define LDBL_MIN_10_EXP DBL_MIN_10_EXP
172 # define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
174 # define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */
179 /* Pull in a function that fixes the 'int' to 'long double' conversion
185 void _Qp_itoq (long double *, int);
186 static void (*_gl_float_fix_itold) (long double *, int) = _Qp_itoq;
189 #endif /* _@GUARD_PREFIX@_FLOAT_H */
190 #endif /* _@GUARD_PREFIX@_FLOAT_H */