annotate lib/float+.h @ 448:5cccf90bf838 3.0 tip

Fixed bug with complex external references generating invalid relocations in the object file
author lost@l-w.ca
date Fri, 05 Nov 2010 22:27:00 -0600
parents b8bf63962a99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
434
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
1 /* Supplemental information about the floating-point formats.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
2 Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
3 Written by Bruno Haible <bruno@clisp.org>, 2007.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
4
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
7 the Free Software Foundation; either version 3, or (at your option)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
8 any later version.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
9
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
13 GNU General Public License for more details.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
14
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
16 along with this program; if not, write to the Free Software Foundation,
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
18
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
19 #ifndef _FLOATPLUS_H
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
20 #define _FLOATPLUS_H
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
21
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
22 #include <float.h>
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
23 #include <limits.h>
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
24
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
25 /* Number of bits in the mantissa of a floating-point number, including the
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
26 "hidden bit". */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
27 #if FLT_RADIX == 2
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
28 # define FLT_MANT_BIT FLT_MANT_DIG
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
29 # define DBL_MANT_BIT DBL_MANT_DIG
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
30 # define LDBL_MANT_BIT LDBL_MANT_DIG
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
31 #elif FLT_RADIX == 4
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
32 # define FLT_MANT_BIT (FLT_MANT_DIG * 2)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
33 # define DBL_MANT_BIT (DBL_MANT_DIG * 2)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
34 # define LDBL_MANT_BIT (LDBL_MANT_DIG * 2)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
35 #elif FLT_RADIX == 16
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
36 # define FLT_MANT_BIT (FLT_MANT_DIG * 4)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
37 # define DBL_MANT_BIT (DBL_MANT_DIG * 4)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
38 # define LDBL_MANT_BIT (LDBL_MANT_DIG * 4)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
39 #endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
40
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
41 /* Bit mask that can be used to mask the exponent, as an unsigned number. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
42 #define FLT_EXP_MASK ((FLT_MAX_EXP - FLT_MIN_EXP) | 7)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
43 #define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
44 #define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
45
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
46 /* Number of bits used for the exponent of a floating-point number, including
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
47 the exponent's sign. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
48 #define FLT_EXP_BIT \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
49 (FLT_EXP_MASK < 0x100 ? 8 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
50 FLT_EXP_MASK < 0x200 ? 9 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
51 FLT_EXP_MASK < 0x400 ? 10 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
52 FLT_EXP_MASK < 0x800 ? 11 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
53 FLT_EXP_MASK < 0x1000 ? 12 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
54 FLT_EXP_MASK < 0x2000 ? 13 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
55 FLT_EXP_MASK < 0x4000 ? 14 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
56 FLT_EXP_MASK < 0x8000 ? 15 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
57 FLT_EXP_MASK < 0x10000 ? 16 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
58 FLT_EXP_MASK < 0x20000 ? 17 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
59 FLT_EXP_MASK < 0x40000 ? 18 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
60 FLT_EXP_MASK < 0x80000 ? 19 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
61 FLT_EXP_MASK < 0x100000 ? 20 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
62 FLT_EXP_MASK < 0x200000 ? 21 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
63 FLT_EXP_MASK < 0x400000 ? 22 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
64 FLT_EXP_MASK < 0x800000 ? 23 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
65 FLT_EXP_MASK < 0x1000000 ? 24 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
66 FLT_EXP_MASK < 0x2000000 ? 25 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
67 FLT_EXP_MASK < 0x4000000 ? 26 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
68 FLT_EXP_MASK < 0x8000000 ? 27 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
69 FLT_EXP_MASK < 0x10000000 ? 28 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
70 FLT_EXP_MASK < 0x20000000 ? 29 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
71 FLT_EXP_MASK < 0x40000000 ? 30 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
72 FLT_EXP_MASK <= 0x7fffffff ? 31 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
73 32)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
74 #define DBL_EXP_BIT \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
75 (DBL_EXP_MASK < 0x100 ? 8 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
76 DBL_EXP_MASK < 0x200 ? 9 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
77 DBL_EXP_MASK < 0x400 ? 10 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
78 DBL_EXP_MASK < 0x800 ? 11 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
79 DBL_EXP_MASK < 0x1000 ? 12 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
80 DBL_EXP_MASK < 0x2000 ? 13 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
81 DBL_EXP_MASK < 0x4000 ? 14 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
82 DBL_EXP_MASK < 0x8000 ? 15 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
83 DBL_EXP_MASK < 0x10000 ? 16 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
84 DBL_EXP_MASK < 0x20000 ? 17 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
85 DBL_EXP_MASK < 0x40000 ? 18 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
86 DBL_EXP_MASK < 0x80000 ? 19 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
87 DBL_EXP_MASK < 0x100000 ? 20 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
88 DBL_EXP_MASK < 0x200000 ? 21 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
89 DBL_EXP_MASK < 0x400000 ? 22 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
90 DBL_EXP_MASK < 0x800000 ? 23 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
91 DBL_EXP_MASK < 0x1000000 ? 24 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
92 DBL_EXP_MASK < 0x2000000 ? 25 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
93 DBL_EXP_MASK < 0x4000000 ? 26 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
94 DBL_EXP_MASK < 0x8000000 ? 27 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
95 DBL_EXP_MASK < 0x10000000 ? 28 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
96 DBL_EXP_MASK < 0x20000000 ? 29 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
97 DBL_EXP_MASK < 0x40000000 ? 30 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
98 DBL_EXP_MASK <= 0x7fffffff ? 31 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
99 32)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
100 #define LDBL_EXP_BIT \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
101 (LDBL_EXP_MASK < 0x100 ? 8 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
102 LDBL_EXP_MASK < 0x200 ? 9 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
103 LDBL_EXP_MASK < 0x400 ? 10 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
104 LDBL_EXP_MASK < 0x800 ? 11 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
105 LDBL_EXP_MASK < 0x1000 ? 12 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
106 LDBL_EXP_MASK < 0x2000 ? 13 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
107 LDBL_EXP_MASK < 0x4000 ? 14 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
108 LDBL_EXP_MASK < 0x8000 ? 15 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
109 LDBL_EXP_MASK < 0x10000 ? 16 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
110 LDBL_EXP_MASK < 0x20000 ? 17 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
111 LDBL_EXP_MASK < 0x40000 ? 18 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
112 LDBL_EXP_MASK < 0x80000 ? 19 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
113 LDBL_EXP_MASK < 0x100000 ? 20 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
114 LDBL_EXP_MASK < 0x200000 ? 21 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
115 LDBL_EXP_MASK < 0x400000 ? 22 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
116 LDBL_EXP_MASK < 0x800000 ? 23 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
117 LDBL_EXP_MASK < 0x1000000 ? 24 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
118 LDBL_EXP_MASK < 0x2000000 ? 25 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
119 LDBL_EXP_MASK < 0x4000000 ? 26 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
120 LDBL_EXP_MASK < 0x8000000 ? 27 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
121 LDBL_EXP_MASK < 0x10000000 ? 28 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
122 LDBL_EXP_MASK < 0x20000000 ? 29 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
123 LDBL_EXP_MASK < 0x40000000 ? 30 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
124 LDBL_EXP_MASK <= 0x7fffffff ? 31 : \
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
125 32)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
126
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
127 /* Number of bits used for a floating-point number: the mantissa (not
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
128 counting the "hidden bit", since it may or may not be explicit), the
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
129 exponent, and the sign. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
130 #define FLT_TOTAL_BIT ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
131 #define DBL_TOTAL_BIT ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
132 #define LDBL_TOTAL_BIT ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
133
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
134 /* Number of bytes used for a floating-point number.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
135 This can be smaller than the 'sizeof'. For example, on i386 systems,
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
136 'long double' most often have LDBL_MANT_BIT = 64, LDBL_EXP_BIT = 16, hence
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
137 LDBL_TOTAL_BIT = 80 bits, i.e. 10 bytes of consecutive memory, but
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
138 sizeof (long double) = 12 or = 16. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
139 #define SIZEOF_FLT ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
140 #define SIZEOF_DBL ((DBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
141 #define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
142
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
143 /* Verify that SIZEOF_FLT <= sizeof (float) etc. */
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
144 typedef int verify_sizeof_flt[2 * (SIZEOF_FLT <= sizeof (float)) - 1];
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
145 typedef int verify_sizeof_dbl[2 * (SIZEOF_DBL <= sizeof (double)) - 1];
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
146 typedef int verify_sizeof_ldbl[2 * (SIZEOF_LDBL <= sizeof (long double)) - 1];
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
147
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
148 #endif /* _FLOATPLUS_H */