1 /* Copyright (C) 1992-2014 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <http://www.gnu.org/licenses/>. */
33 /* This is the IEEE 754 single-precision format. */
36 #if __BYTE_ORDER == __BIG_ENDIAN
37 unsigned int negative
:1;
38 unsigned int exponent
:8;
39 unsigned int mantissa
:23;
40 #endif /* Big endian. */
41 #if __BYTE_ORDER == __LITTLE_ENDIAN
42 unsigned int mantissa
:23;
43 unsigned int exponent
:8;
44 unsigned int negative
:1;
45 #endif /* Little endian. */
48 /* This format makes it easier to see if a NaN is a signalling NaN. */
51 #if __BYTE_ORDER == __BIG_ENDIAN
52 unsigned int negative
:1;
53 unsigned int exponent
:8;
54 unsigned int quiet_nan
:1;
55 unsigned int mantissa
:22;
56 #endif /* Big endian. */
57 #if __BYTE_ORDER == __LITTLE_ENDIAN
58 unsigned int mantissa
:22;
59 unsigned int quiet_nan
:1;
60 unsigned int exponent
:8;
61 unsigned int negative
:1;
62 #endif /* Little endian. */
66 #define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */
73 /* This is the IEEE 754 double-precision format. */
76 #if __BYTE_ORDER == __BIG_ENDIAN
77 unsigned int negative
:1;
78 unsigned int exponent
:11;
79 /* Together these comprise the mantissa. */
80 unsigned int mantissa0
:20;
81 unsigned int mantissa1
:32;
82 #endif /* Big endian. */
83 #if __BYTE_ORDER == __LITTLE_ENDIAN
84 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
85 unsigned int mantissa0
:20;
86 unsigned int exponent
:11;
87 unsigned int negative
:1;
88 unsigned int mantissa1
:32;
90 /* Together these comprise the mantissa. */
91 unsigned int mantissa1
:32;
92 unsigned int mantissa0
:20;
93 unsigned int exponent
:11;
94 unsigned int negative
:1;
96 #endif /* Little endian. */
99 /* This format makes it easier to see if a NaN is a signalling NaN. */
102 #if __BYTE_ORDER == __BIG_ENDIAN
103 unsigned int negative
:1;
104 unsigned int exponent
:11;
105 unsigned int quiet_nan
:1;
106 /* Together these comprise the mantissa. */
107 unsigned int mantissa0
:19;
108 unsigned int mantissa1
:32;
110 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
111 unsigned int mantissa0
:19;
112 unsigned int quiet_nan
:1;
113 unsigned int exponent
:11;
114 unsigned int negative
:1;
115 unsigned int mantissa1
:32;
117 /* Together these comprise the mantissa. */
118 unsigned int mantissa1
:32;
119 unsigned int mantissa0
:19;
120 unsigned int quiet_nan
:1;
121 unsigned int exponent
:11;
122 unsigned int negative
:1;
128 #define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
130 #if LDBL_MANT_DIG == 113
132 union ieee854_long_double
136 /* This is the IEEE 854 quad-precision format. */
139 #if __BYTE_ORDER == __BIG_ENDIAN
140 unsigned int negative
:1;
141 unsigned int exponent
:15;
142 /* Together these comprise the mantissa. */
143 unsigned int mantissa0
:16;
144 unsigned int mantissa1
:32;
145 unsigned int mantissa2
:32;
146 unsigned int mantissa3
:32;
147 #endif /* Big endian. */
148 #if __BYTE_ORDER == __LITTLE_ENDIAN
149 /* Together these comprise the mantissa. */
150 unsigned int mantissa3
:32;
151 unsigned int mantissa2
:32;
152 unsigned int mantissa1
:32;
153 unsigned int mantissa0
:16;
154 unsigned int exponent
:15;
155 unsigned int negative
:1;
156 #endif /* Little endian. */
159 /* This format makes it easier to see if a NaN is a signalling NaN. */
162 #if __BYTE_ORDER == __BIG_ENDIAN
163 unsigned int negative
:1;
164 unsigned int exponent
:15;
165 unsigned int quiet_nan
:1;
166 /* Together these comprise the mantissa. */
167 unsigned int mantissa0
:15;
168 unsigned int mantissa1
:32;
169 unsigned int mantissa2
:32;
170 unsigned int mantissa3
:32;
171 #endif /* Big endian. */
172 #if __BYTE_ORDER == __LITTLE_ENDIAN
173 /* Together these comprise the mantissa. */
174 unsigned int mantissa3
:32;
175 unsigned int mantissa2
:32;
176 unsigned int mantissa1
:32;
177 unsigned int mantissa0
:15;
178 unsigned int quiet_nan
:1;
179 unsigned int exponent
:15;
180 unsigned int negative
:1;
181 #endif /* Little endian. */
185 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */
187 #elif LDBL_MANT_DIG == 64
189 union ieee854_long_double
193 /* This is the IEEE 854 double-extended-precision format. */
196 #if __BYTE_ORDER == __BIG_ENDIAN
197 unsigned int negative
:1;
198 unsigned int exponent
:15;
199 unsigned int empty
:16;
200 unsigned int mantissa0
:32;
201 unsigned int mantissa1
:32;
203 #if __BYTE_ORDER == __LITTLE_ENDIAN
204 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
205 unsigned int exponent
:15;
206 unsigned int negative
:1;
207 unsigned int empty
:16;
208 unsigned int mantissa0
:32;
209 unsigned int mantissa1
:32;
211 unsigned int mantissa1
:32;
212 unsigned int mantissa0
:32;
213 unsigned int exponent
:15;
214 unsigned int negative
:1;
215 unsigned int empty
:16;
220 /* This is for NaNs in the IEEE 854 double-extended-precision format. */
223 #if __BYTE_ORDER == __BIG_ENDIAN
224 unsigned int negative
:1;
225 unsigned int exponent
:15;
226 unsigned int empty
:16;
228 unsigned int quiet_nan
:1;
229 unsigned int mantissa0
:30;
230 unsigned int mantissa1
:32;
232 #if __BYTE_ORDER == __LITTLE_ENDIAN
233 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
234 unsigned int exponent
:15;
235 unsigned int negative
:1;
236 unsigned int empty
:16;
237 unsigned int mantissa0
:30;
238 unsigned int quiet_nan
:1;
240 unsigned int mantissa1
:32;
242 unsigned int mantissa1
:32;
243 unsigned int mantissa0
:30;
244 unsigned int quiet_nan
:1;
246 unsigned int exponent
:15;
247 unsigned int negative
:1;
248 unsigned int empty
:16;
254 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
256 #elif LDBL_MANT_DIG == 53
258 union ieee854_long_double
262 /* This is the IEEE 754 double-precision format. */
265 #if __BYTE_ORDER == __BIG_ENDIAN
266 unsigned int negative
:1;
267 unsigned int exponent
:11;
268 /* Together these comprise the mantissa. */
269 unsigned int mantissa0
:20;
270 unsigned int mantissa1
:32;
271 #endif /* Big endian. */
272 #if __BYTE_ORDER == __LITTLE_ENDIAN
273 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
274 unsigned int mantissa0
:20;
275 unsigned int exponent
:11;
276 unsigned int negative
:1;
277 unsigned int mantissa1
:32;
279 /* Together these comprise the mantissa. */
280 unsigned int mantissa1
:32;
281 unsigned int mantissa0
:20;
282 unsigned int exponent
:11;
283 unsigned int negative
:1;
285 #endif /* Little endian. */
288 /* This format makes it easier to see if a NaN is a signalling NaN. */
291 #if __BYTE_ORDER == __BIG_ENDIAN
292 unsigned int negative
:1;
293 unsigned int exponent
:11;
294 unsigned int quiet_nan
:1;
295 /* Together these comprise the mantissa. */
296 unsigned int mantissa0
:19;
297 unsigned int mantissa1
:32;
299 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
300 unsigned int mantissa0
:19;
301 unsigned int quiet_nan
:1;
302 unsigned int exponent
:11;
303 unsigned int negative
:1;
304 unsigned int mantissa1
:32;
306 /* Together these comprise the mantissa. */
307 unsigned int mantissa1
:32;
308 unsigned int mantissa0
:19;
309 unsigned int quiet_nan
:1;
310 unsigned int exponent
:11;
311 unsigned int negative
:1;
317 #define IEEE854_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent. */
319 #endif /* LDBL_MANT_DIG == 53 */
323 #endif /* ieee754.h */