1 /* Copyright (C) 1992, 1995, 1996, 1999, 2002, 2003
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <http://www.gnu.org/licenses/>. */
34 /* This is the IEEE 754 single-precision format. */
37 #if __BYTE_ORDER == __BIG_ENDIAN
38 unsigned int negative
:1;
39 unsigned int exponent
:8;
40 unsigned int mantissa
:23;
41 #endif /* Big endian. */
42 #if __BYTE_ORDER == __LITTLE_ENDIAN
43 unsigned int mantissa
:23;
44 unsigned int exponent
:8;
45 unsigned int negative
:1;
46 #endif /* Little endian. */
49 /* This format makes it easier to see if a NaN is a signalling NaN. */
52 #if __BYTE_ORDER == __BIG_ENDIAN
53 unsigned int negative
:1;
54 unsigned int exponent
:8;
55 unsigned int quiet_nan
:1;
56 unsigned int mantissa
:22;
57 #endif /* Big endian. */
58 #if __BYTE_ORDER == __LITTLE_ENDIAN
59 unsigned int mantissa
:22;
60 unsigned int quiet_nan
:1;
61 unsigned int exponent
:8;
62 unsigned int negative
:1;
63 #endif /* Little endian. */
67 #define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */
74 /* This is the IEEE 754 double-precision format. */
77 #if __BYTE_ORDER == __BIG_ENDIAN
78 unsigned int negative
:1;
79 unsigned int exponent
:11;
80 /* Together these comprise the mantissa. */
81 unsigned int mantissa0
:20;
82 unsigned int mantissa1
:32;
83 #endif /* Big endian. */
84 #if __BYTE_ORDER == __LITTLE_ENDIAN
85 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
86 unsigned int mantissa0
:20;
87 unsigned int exponent
:11;
88 unsigned int negative
:1;
89 unsigned int mantissa1
:32;
91 /* Together these comprise the mantissa. */
92 unsigned int mantissa1
:32;
93 unsigned int mantissa0
:20;
94 unsigned int exponent
:11;
95 unsigned int negative
:1;
97 #endif /* Little endian. */
100 /* This format makes it easier to see if a NaN is a signalling NaN. */
103 #if __BYTE_ORDER == __BIG_ENDIAN
104 unsigned int negative
:1;
105 unsigned int exponent
:11;
106 unsigned int quiet_nan
:1;
107 /* Together these comprise the mantissa. */
108 unsigned int mantissa0
:19;
109 unsigned int mantissa1
:32;
111 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
112 unsigned int mantissa0
:19;
113 unsigned int quiet_nan
:1;
114 unsigned int exponent
:11;
115 unsigned int negative
:1;
116 unsigned int mantissa1
:32;
118 /* Together these comprise the mantissa. */
119 unsigned int mantissa1
:32;
120 unsigned int mantissa0
:19;
121 unsigned int quiet_nan
:1;
122 unsigned int exponent
:11;
123 unsigned int negative
:1;
129 #define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
131 #if LDBL_MANT_DIG == 113
133 union ieee854_long_double
137 /* This is the IEEE 854 quad-precision format. */
140 #if __BYTE_ORDER == __BIG_ENDIAN
141 unsigned int negative
:1;
142 unsigned int exponent
:15;
143 /* Together these comprise the mantissa. */
144 unsigned int mantissa0
:16;
145 unsigned int mantissa1
:32;
146 unsigned int mantissa2
:32;
147 unsigned int mantissa3
:32;
148 #endif /* Big endian. */
149 #if __BYTE_ORDER == __LITTLE_ENDIAN
150 /* Together these comprise the mantissa. */
151 unsigned int mantissa3
:32;
152 unsigned int mantissa2
:32;
153 unsigned int mantissa1
:32;
154 unsigned int mantissa0
:16;
155 unsigned int exponent
:15;
156 unsigned int negative
:1;
157 #endif /* Little endian. */
160 /* This format makes it easier to see if a NaN is a signalling NaN. */
163 #if __BYTE_ORDER == __BIG_ENDIAN
164 unsigned int negative
:1;
165 unsigned int exponent
:15;
166 unsigned int quiet_nan
:1;
167 /* Together these comprise the mantissa. */
168 unsigned int mantissa0
:15;
169 unsigned int mantissa1
:32;
170 unsigned int mantissa2
:32;
171 unsigned int mantissa3
:32;
172 #endif /* Big endian. */
173 #if __BYTE_ORDER == __LITTLE_ENDIAN
174 /* Together these comprise the mantissa. */
175 unsigned int mantissa3
:32;
176 unsigned int mantissa2
:32;
177 unsigned int mantissa1
:32;
178 unsigned int mantissa0
:15;
179 unsigned int quiet_nan
:1;
180 unsigned int exponent
:15;
181 unsigned int negative
:1;
182 #endif /* Little endian. */
186 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */
188 #elif LDBL_MANT_DIG == 64
190 union ieee854_long_double
194 /* This is the IEEE 854 double-extended-precision format. */
197 #if __BYTE_ORDER == __BIG_ENDIAN
198 unsigned int negative
:1;
199 unsigned int exponent
:15;
200 unsigned int empty
:16;
201 unsigned int mantissa0
:32;
202 unsigned int mantissa1
:32;
204 #if __BYTE_ORDER == __LITTLE_ENDIAN
205 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
206 unsigned int exponent
:15;
207 unsigned int negative
:1;
208 unsigned int empty
:16;
209 unsigned int mantissa0
:32;
210 unsigned int mantissa1
:32;
212 unsigned int mantissa1
:32;
213 unsigned int mantissa0
:32;
214 unsigned int exponent
:15;
215 unsigned int negative
:1;
216 unsigned int empty
:16;
221 /* This is for NaNs in the IEEE 854 double-extended-precision format. */
224 #if __BYTE_ORDER == __BIG_ENDIAN
225 unsigned int negative
:1;
226 unsigned int exponent
:15;
227 unsigned int empty
:16;
229 unsigned int quiet_nan
:1;
230 unsigned int mantissa0
:30;
231 unsigned int mantissa1
:32;
233 #if __BYTE_ORDER == __LITTLE_ENDIAN
234 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
235 unsigned int exponent
:15;
236 unsigned int negative
:1;
237 unsigned int empty
:16;
238 unsigned int mantissa0
:30;
239 unsigned int quiet_nan
:1;
241 unsigned int mantissa1
:32;
243 unsigned int mantissa1
:32;
244 unsigned int mantissa0
:30;
245 unsigned int quiet_nan
:1;
247 unsigned int exponent
:15;
248 unsigned int negative
:1;
249 unsigned int empty
:16;
255 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
257 #elif LDBL_MANT_DIG == 53
259 union ieee854_long_double
263 /* This is the IEEE 754 double-precision format. */
266 #if __BYTE_ORDER == __BIG_ENDIAN
267 unsigned int negative
:1;
268 unsigned int exponent
:11;
269 /* Together these comprise the mantissa. */
270 unsigned int mantissa0
:20;
271 unsigned int mantissa1
:32;
272 #endif /* Big endian. */
273 #if __BYTE_ORDER == __LITTLE_ENDIAN
274 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
275 unsigned int mantissa0
:20;
276 unsigned int exponent
:11;
277 unsigned int negative
:1;
278 unsigned int mantissa1
:32;
280 /* Together these comprise the mantissa. */
281 unsigned int mantissa1
:32;
282 unsigned int mantissa0
:20;
283 unsigned int exponent
:11;
284 unsigned int negative
:1;
286 #endif /* Little endian. */
289 /* This format makes it easier to see if a NaN is a signalling NaN. */
292 #if __BYTE_ORDER == __BIG_ENDIAN
293 unsigned int negative
:1;
294 unsigned int exponent
:11;
295 unsigned int quiet_nan
:1;
296 /* Together these comprise the mantissa. */
297 unsigned int mantissa0
:19;
298 unsigned int mantissa1
:32;
300 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
301 unsigned int mantissa0
:19;
302 unsigned int quiet_nan
:1;
303 unsigned int exponent
:11;
304 unsigned int negative
:1;
305 unsigned int mantissa1
:32;
307 /* Together these comprise the mantissa. */
308 unsigned int mantissa1
:32;
309 unsigned int mantissa0
:19;
310 unsigned int quiet_nan
:1;
311 unsigned int exponent
:11;
312 unsigned int negative
:1;
318 #define IEEE854_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent. */
320 #endif /* LDBL_MANT_DIG == 53 */
324 #endif /* ieee754.h */