annotate lib/float.in.h @ 17429:88b6febaed97

tests: port large-fd POSIX spawn tests to OS X Problem reported by Daiki Ueno in <http://lists.gnu.org/archive/html/bug-gnulib/2013-06/msg00031.html>. * tests/test-posix_spawn_file_actions_addclose.c: * tests/test-posix_spawn_file_actions_adddup2.c: * tests/test-posix_spawn_file_actions_addopen.c: Include <limits.h>, for OPEN_MAX, if available. (big_fd): New static function. (main): Use it.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 11 Jun 2013 00:10:21 -0700
parents e542fd46ad6f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9248
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* A correct <float.h>.
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16201
diff changeset
3 Copyright (C) 2007-2013 Free Software Foundation, Inc.
9248
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9248
diff changeset
5 This program is free software: you can redistribute it and/or modify
9248
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9248
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9248
diff changeset
8 (at your option) any later version.
9248
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9248
diff changeset
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
9248
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
18 #ifndef _@GUARD_PREFIX@_FLOAT_H
13094
2ed0fc659db8 Emit #pragma system_header after the inclusion guard, not before.
Bruno Haible <bruno@clisp.org>
parents: 13055
diff changeset
19
10655
8668b19a7032 Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
20 #if __GNUC__ >= 3
10375
f96e845fc36d Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents: 9519
diff changeset
21 @PRAGMA_SYSTEM_HEADER@
10655
8668b19a7032 Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
22 #endif
13761
a19ace3ba849 Avoid line length limitation from HP NonStop system header files.
Bruno Haible <bruno@clisp.org>
parents: 13094
diff changeset
23 @PRAGMA_COLUMNS@
10375
f96e845fc36d Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents: 9519
diff changeset
24
9248
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 /* The include_next requires a split double-inclusion guard. */
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 #@INCLUDE_NEXT@ @NEXT_FLOAT_H@
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
28 #ifndef _@GUARD_PREFIX@_FLOAT_H
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
29 #define _@GUARD_PREFIX@_FLOAT_H
9248
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 /* 'long double' properties. */
15301
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
32
9519
ced96e4df8ab Fix OpenBSD 4.0 <float.h> handling of long double.
Eric Blake <ebb9@byu.net>
parents: 9309
diff changeset
33 #if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
9248
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 /* Number of mantissa units, in base FLT_RADIX. */
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 # undef LDBL_MANT_DIG
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 # define LDBL_MANT_DIG 64
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 /* Number of decimal digits that is sufficient for representing a number. */
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 # undef LDBL_DIG
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 # define LDBL_DIG 18
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 /* x-1 where x is the smallest representable number > 1. */
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 # undef LDBL_EPSILON
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 # define LDBL_EPSILON 1.0842021724855044340E-19L
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 /* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 # undef LDBL_MIN_EXP
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 # define LDBL_MIN_EXP (-16381)
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 /* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 # undef LDBL_MAX_EXP
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 # define LDBL_MAX_EXP 16384
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 /* Minimum positive normalized number. */
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 # undef LDBL_MIN
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 # define LDBL_MIN 3.3621031431120935063E-4932L
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 /* Maximum representable finite number. */
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 # undef LDBL_MAX
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 # define LDBL_MAX 1.1897314953572317650E+4932L
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 /* Minimum e such that 10^e is in the range of normalized numbers. */
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 # undef LDBL_MIN_10_EXP
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 # define LDBL_MIN_10_EXP (-4931)
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 /* Maximum e such that 10^e is in the range of representable finite numbers. */
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 # undef LDBL_MAX_10_EXP
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 # define LDBL_MAX_10_EXP 4932
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 #endif
8bca1b6ce9d4 Rename float_.h to float.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62
15301
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
63 /* On FreeBSD/x86 6.4, the 'long double' type really has only 53 bits of
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
64 precision in the compiler but 64 bits of precision at runtime. See
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
65 <http://lists.gnu.org/archive/html/bug-gnulib/2008-07/msg00063.html>. */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
66 #if defined __i386__ && defined __FreeBSD__
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
67 /* Number of mantissa units, in base FLT_RADIX. */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
68 # undef LDBL_MANT_DIG
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
69 # define LDBL_MANT_DIG 64
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
70 /* Number of decimal digits that is sufficient for representing a number. */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
71 # undef LDBL_DIG
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
72 # define LDBL_DIG 18
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
73 /* x-1 where x is the smallest representable number > 1. */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
74 # undef LDBL_EPSILON
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
75 # define LDBL_EPSILON 1.084202172485504434007452800869941711426e-19L /* 2^-63 */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
76 /* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
77 # undef LDBL_MIN_EXP
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
78 # define LDBL_MIN_EXP (-16381)
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
79 /* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
80 # undef LDBL_MAX_EXP
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
81 # define LDBL_MAX_EXP 16384
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
82 /* Minimum positive normalized number. */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
83 # undef LDBL_MIN
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
84 # define LDBL_MIN 3.3621031431120935E-4932L /* = 0x1p-16382L */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
85 /* Maximum representable finite number. */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
86 # undef LDBL_MAX
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
87 /* LDBL_MAX is represented as { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }.
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
88 But the largest literal that GCC allows us to write is
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
89 0x0.fffffffffffff8p16384L = { 0xFFFFF800, 0xFFFFFFFF, 32766 }.
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
90 So, define it like this through a reference to an external variable
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
91
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
92 const unsigned int LDBL_MAX[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 32766 };
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
93 extern const long double LDBL_MAX;
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
94
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
95 Unfortunately, this is not a constant expression. */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
96 union gl_long_double_union
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
97 {
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
98 struct { unsigned int lo; unsigned int hi; unsigned int exponent; } xd;
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
99 long double ld;
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
100 };
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
101 extern const union gl_long_double_union gl_LDBL_MAX;
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
102 # define LDBL_MAX (gl_LDBL_MAX.ld)
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
103 /* Minimum e such that 10^e is in the range of normalized numbers. */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
104 # undef LDBL_MIN_10_EXP
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
105 # define LDBL_MIN_10_EXP (-4931)
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
106 /* Maximum e such that 10^e is in the range of representable finite numbers. */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
107 # undef LDBL_MAX_10_EXP
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
108 # define LDBL_MAX_10_EXP 4932
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
109 #endif
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
110
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
111 /* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are
15799
f1d36de2d2bb float: Fix LDBL_MAX value on Linux/PowerPC.
Bruno Haible <bruno@clisp.org>
parents: 15301
diff changeset
112 wrong.
f1d36de2d2bb float: Fix LDBL_MAX value on Linux/PowerPC.
Bruno Haible <bruno@clisp.org>
parents: 15301
diff changeset
113 On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong. */
15301
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
114 #if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
115 # undef LDBL_MIN_EXP
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
116 # define LDBL_MIN_EXP DBL_MIN_EXP
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
117 # undef LDBL_MIN_10_EXP
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
118 # define LDBL_MIN_10_EXP DBL_MIN_10_EXP
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
119 # undef LDBL_MIN
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
120 # define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
15799
f1d36de2d2bb float: Fix LDBL_MAX value on Linux/PowerPC.
Bruno Haible <bruno@clisp.org>
parents: 15301
diff changeset
121 #endif
f1d36de2d2bb float: Fix LDBL_MAX value on Linux/PowerPC.
Bruno Haible <bruno@clisp.org>
parents: 15301
diff changeset
122 #if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
15301
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
123 # undef LDBL_MAX
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
124 /* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }.
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
125 It is not easy to define:
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
126 #define LDBL_MAX 1.79769313486231580793728971405302307166e308L
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
127 is too small, whereas
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
128 #define LDBL_MAX 1.79769313486231580793728971405302307167e308L
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
129 is too large. Apparently a bug in GCC decimal-to-binary conversion.
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
130 Also, I can't get values larger than
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
131 #define LDBL63 ((long double) (1ULL << 63))
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
132 #define LDBL882 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
133 #define LDBL945 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
134 #define LDBL1008 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
135 #define LDBL_MAX (LDBL1008 * 65535.0L + LDBL945 * (long double) 9223372036821221375ULL + LDBL882 * (long double) 4611686018427387904ULL)
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
136 which is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xF8000000 }.
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
137 So, define it like this through a reference to an external variable
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
138
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
139 const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL };
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
140 extern const long double LDBL_MAX;
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
141
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
142 or through a pointer cast
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
143
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
144 #define LDBL_MAX \
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
145 (*(const long double *) (double[]) { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL })
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
146
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
147 Unfortunately, this is not a constant expression, and the latter expression
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
148 does not work well when GCC is optimizing.. */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
149 union gl_long_double_union
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
150 {
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
151 struct { double hi; double lo; } dd;
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
152 long double ld;
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
153 };
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
154 extern const union gl_long_double_union gl_LDBL_MAX;
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
155 # define LDBL_MAX (gl_LDBL_MAX.ld)
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
156 #endif
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
157
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
158 /* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong.
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
159 On IRIX 6.5, with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_EPSILON
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
160 are wrong. */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
161 #if defined __sgi && (LDBL_MANT_DIG >= 106)
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
162 # undef LDBL_MANT_DIG
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
163 # define LDBL_MANT_DIG 106
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
164 # if defined __GNUC__
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
165 # undef LDBL_MIN_EXP
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
166 # define LDBL_MIN_EXP DBL_MIN_EXP
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
167 # undef LDBL_MIN_10_EXP
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
168 # define LDBL_MIN_10_EXP DBL_MIN_10_EXP
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
169 # undef LDBL_MIN
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
170 # define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
171 # undef LDBL_EPSILON
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
172 # define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
173 # endif
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
174 #endif
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
175
15803
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
176 #if @REPLACE_ITOLD@
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
177 /* Pull in a function that fixes the 'int' to 'long double' conversion
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
178 of glibc 2.7. */
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
179 extern
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
180 # ifdef __cplusplus
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
181 "C"
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
182 # endif
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
183 void _Qp_itoq (long double *, int);
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
184 static void (*_gl_float_fix_itold) (long double *, int) = _Qp_itoq;
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
185 #endif
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
186
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
187 #endif /* _@GUARD_PREFIX@_FLOAT_H */
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
188 #endif /* _@GUARD_PREFIX@_FLOAT_H */