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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
35 /* This is the IEEE 754 single-precision format. */
38 #if __BYTE_ORDER == __BIG_ENDIAN
39 unsigned int negative
:1;
40 unsigned int exponent
:8;
41 unsigned int mantissa
:23;
42 #endif /* Big endian. */
43 #if __BYTE_ORDER == __LITTLE_ENDIAN
44 unsigned int mantissa
:23;
45 unsigned int exponent
:8;
46 unsigned int negative
:1;
47 #endif /* Little endian. */
50 /* This format makes it easier to see if a NaN is a signalling NaN. */
53 #if __BYTE_ORDER == __BIG_ENDIAN
54 unsigned int negative
:1;
55 unsigned int exponent
:8;
56 unsigned int quiet_nan
:1;
57 unsigned int mantissa
:22;
58 #endif /* Big endian. */
59 #if __BYTE_ORDER == __LITTLE_ENDIAN
60 unsigned int mantissa
:22;
61 unsigned int quiet_nan
:1;
62 unsigned int exponent
:8;
63 unsigned int negative
:1;
64 #endif /* Little endian. */
68 #define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */
75 /* This is the IEEE 754 double-precision format. */
78 #if __BYTE_ORDER == __BIG_ENDIAN
79 unsigned int negative
:1;
80 unsigned int exponent
:11;
81 /* Together these comprise the mantissa. */
82 unsigned int mantissa0
:20;
83 unsigned int mantissa1
:32;
84 #endif /* Big endian. */
85 #if __BYTE_ORDER == __LITTLE_ENDIAN
86 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
87 unsigned int mantissa0
:20;
88 unsigned int exponent
:11;
89 unsigned int negative
:1;
90 unsigned int mantissa1
:32;
92 /* Together these comprise the mantissa. */
93 unsigned int mantissa1
:32;
94 unsigned int mantissa0
:20;
95 unsigned int exponent
:11;
96 unsigned int negative
:1;
98 #endif /* Little endian. */
101 /* This format makes it easier to see if a NaN is a signalling NaN. */
104 #if __BYTE_ORDER == __BIG_ENDIAN
105 unsigned int negative
:1;
106 unsigned int exponent
:11;
107 unsigned int quiet_nan
:1;
108 /* Together these comprise the mantissa. */
109 unsigned int mantissa0
:19;
110 unsigned int mantissa1
:32;
112 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
113 unsigned int mantissa0
:19;
114 unsigned int quiet_nan
:1;
115 unsigned int exponent
:11;
116 unsigned int negative
:1;
117 unsigned int mantissa1
:32;
119 /* Together these comprise the mantissa. */
120 unsigned int mantissa1
:32;
121 unsigned int mantissa0
:19;
122 unsigned int quiet_nan
:1;
123 unsigned int exponent
:11;
124 unsigned int negative
:1;
130 #define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
132 #if LDBL_MANT_DIG == 113
134 union ieee854_long_double
138 /* This is the IEEE 854 quad-precision format. */
141 #if __BYTE_ORDER == __BIG_ENDIAN
142 unsigned int negative
:1;
143 unsigned int exponent
:15;
144 /* Together these comprise the mantissa. */
145 unsigned int mantissa0
:16;
146 unsigned int mantissa1
:32;
147 unsigned int mantissa2
:32;
148 unsigned int mantissa3
:32;
149 #endif /* Big endian. */
150 #if __BYTE_ORDER == __LITTLE_ENDIAN
151 /* Together these comprise the mantissa. */
152 unsigned int mantissa3
:32;
153 unsigned int mantissa2
:32;
154 unsigned int mantissa1
:32;
155 unsigned int mantissa0
:16;
156 unsigned int exponent
:15;
157 unsigned int negative
:1;
158 #endif /* Little endian. */
161 /* This format makes it easier to see if a NaN is a signalling NaN. */
164 #if __BYTE_ORDER == __BIG_ENDIAN
165 unsigned int negative
:1;
166 unsigned int exponent
:15;
167 unsigned int quiet_nan
:1;
168 /* Together these comprise the mantissa. */
169 unsigned int mantissa0
:15;
170 unsigned int mantissa1
:32;
171 unsigned int mantissa2
:32;
172 unsigned int mantissa3
:32;
173 #endif /* Big endian. */
174 #if __BYTE_ORDER == __LITTLE_ENDIAN
175 /* Together these comprise the mantissa. */
176 unsigned int mantissa3
:32;
177 unsigned int mantissa2
:32;
178 unsigned int mantissa1
:32;
179 unsigned int mantissa0
:15;
180 unsigned int quiet_nan
:1;
181 unsigned int exponent
:15;
182 unsigned int negative
:1;
183 #endif /* Little endian. */
187 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */
189 #elif LDBL_MANT_DIG == 64
191 union ieee854_long_double
195 /* This is the IEEE 854 double-extended-precision format. */
198 #if __BYTE_ORDER == __BIG_ENDIAN
199 unsigned int negative
:1;
200 unsigned int exponent
:15;
201 unsigned int empty
:16;
202 unsigned int mantissa0
:32;
203 unsigned int mantissa1
:32;
205 #if __BYTE_ORDER == __LITTLE_ENDIAN
206 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
207 unsigned int exponent
:15;
208 unsigned int negative
:1;
209 unsigned int empty
:16;
210 unsigned int mantissa0
:32;
211 unsigned int mantissa1
:32;
213 unsigned int mantissa1
:32;
214 unsigned int mantissa0
:32;
215 unsigned int exponent
:15;
216 unsigned int negative
:1;
217 unsigned int empty
:16;
222 /* This is for NaNs in the IEEE 854 double-extended-precision format. */
225 #if __BYTE_ORDER == __BIG_ENDIAN
226 unsigned int negative
:1;
227 unsigned int exponent
:15;
228 unsigned int empty
:16;
230 unsigned int quiet_nan
:1;
231 unsigned int mantissa0
:30;
232 unsigned int mantissa1
:32;
234 #if __BYTE_ORDER == __LITTLE_ENDIAN
235 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
236 unsigned int exponent
:15;
237 unsigned int negative
:1;
238 unsigned int empty
:16;
239 unsigned int mantissa0
:30;
240 unsigned int quiet_nan
:1;
242 unsigned int mantissa1
:32;
244 unsigned int mantissa1
:32;
245 unsigned int mantissa0
:30;
246 unsigned int quiet_nan
:1;
248 unsigned int exponent
:15;
249 unsigned int negative
:1;
250 unsigned int empty
:16;
256 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
258 #elif LDBL_MANT_DIG == 53
260 union ieee854_long_double
264 /* This is the IEEE 754 double-precision format. */
267 #if __BYTE_ORDER == __BIG_ENDIAN
268 unsigned int negative
:1;
269 unsigned int exponent
:11;
270 /* Together these comprise the mantissa. */
271 unsigned int mantissa0
:20;
272 unsigned int mantissa1
:32;
273 #endif /* Big endian. */
274 #if __BYTE_ORDER == __LITTLE_ENDIAN
275 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
276 unsigned int mantissa0
:20;
277 unsigned int exponent
:11;
278 unsigned int negative
:1;
279 unsigned int mantissa1
:32;
281 /* Together these comprise the mantissa. */
282 unsigned int mantissa1
:32;
283 unsigned int mantissa0
:20;
284 unsigned int exponent
:11;
285 unsigned int negative
:1;
287 #endif /* Little endian. */
290 /* This format makes it easier to see if a NaN is a signalling NaN. */
293 #if __BYTE_ORDER == __BIG_ENDIAN
294 unsigned int negative
:1;
295 unsigned int exponent
:11;
296 unsigned int quiet_nan
:1;
297 /* Together these comprise the mantissa. */
298 unsigned int mantissa0
:19;
299 unsigned int mantissa1
:32;
301 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
302 unsigned int mantissa0
:19;
303 unsigned int quiet_nan
:1;
304 unsigned int exponent
:11;
305 unsigned int negative
:1;
306 unsigned int mantissa1
:32;
308 /* Together these comprise the mantissa. */
309 unsigned int mantissa1
:32;
310 unsigned int mantissa0
:19;
311 unsigned int quiet_nan
:1;
312 unsigned int exponent
:11;
313 unsigned int negative
:1;
319 #define IEEE854_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent. */
321 #endif /* LDBL_MANT_DIG == 53 */
325 #endif /* ieee754.h */