1 /* Copyright (C) 1992, 1995, 1996, 1999 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, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 #define LITTLE_ENDIAN 0x76543210
24 #define BIG_ENDIAN 0x01234567
25 #define __FLOAT_WORD_ORDER LITTLE_ENDIAN
32 /* This is the IEEE 754 single-precision format. */
35 #ifdef WORDS_BIGENDIAN
36 unsigned int negative:1;
37 unsigned int exponent:8;
38 unsigned int mantissa:23;
40 unsigned int mantissa:23;
41 unsigned int exponent:8;
42 unsigned int negative:1;
43 #endif /* Little endian. */
46 /* This format makes it easier to see if a NaN is a signalling NaN. */
49 #ifdef WORDS_BIGENDIAN
50 unsigned int negative:1;
51 unsigned int exponent:8;
52 unsigned int quiet_nan:1;
53 unsigned int mantissa:22;
55 unsigned int mantissa:22;
56 unsigned int quiet_nan:1;
57 unsigned int exponent:8;
58 unsigned int negative:1;
59 #endif /* Little endian. */
63 #define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */
70 /* This is the IEEE 754 double-precision format. */
73 #ifdef WORDS_BIGENDIAN
74 unsigned int negative:1;
75 unsigned int exponent:11;
76 /* Together these comprise the mantissa. */
77 unsigned int mantissa0:20;
78 unsigned int mantissa1:32;
80 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
81 unsigned int mantissa0:20;
82 unsigned int exponent:11;
83 unsigned int negative:1;
84 unsigned int mantissa1:32;
86 /* Together these comprise the mantissa. */
87 unsigned int mantissa1:32;
88 unsigned int mantissa0:20;
89 unsigned int exponent:11;
90 unsigned int negative:1;
92 #endif /* Little endian. */
95 /* This format makes it easier to see if a NaN is a signalling NaN. */
98 #ifdef WORDS_BIGENDIAN
99 unsigned int negative:1;
100 unsigned int exponent:11;
101 unsigned int quiet_nan:1;
102 /* Together these comprise the mantissa. */
103 unsigned int mantissa0:19;
104 unsigned int mantissa1:32;
106 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
107 unsigned int mantissa0:19;
108 unsigned int quiet_nan:1;
109 unsigned int exponent:11;
110 unsigned int negative:1;
111 unsigned int mantissa1:32;
113 /* Together these comprise the mantissa. */
114 unsigned int mantissa1:32;
115 unsigned int mantissa0:19;
116 unsigned int quiet_nan:1;
117 unsigned int exponent:11;
118 unsigned int negative:1;
124 #define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
127 union ieee854_long_double
131 /* This is the IEEE 854 double-extended-precision format. */
134 #ifdef WORDS_BIGENDIAN
135 unsigned int negative:1;
136 unsigned int exponent:15;
137 unsigned int empty:16;
138 unsigned int mantissa0:32;
139 unsigned int mantissa1:32;
141 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
142 unsigned int exponent:15;
143 unsigned int negative:1;
144 unsigned int empty:16;
145 unsigned int mantissa0:32;
146 unsigned int mantissa1:32;
148 unsigned int mantissa1:32;
149 unsigned int mantissa0:32;
150 unsigned int exponent:15;
151 unsigned int negative:1;
152 unsigned int empty:16;
157 /* This is for NaNs in the IEEE 854 double-extended-precision format. */
160 #ifdef WORDS_BIGENDIAN
161 unsigned int negative:1;
162 unsigned int exponent:15;
163 unsigned int empty:16;
165 unsigned int quiet_nan:1;
166 unsigned int mantissa0:30;
167 unsigned int mantissa1:32;
169 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
170 unsigned int exponent:15;
171 unsigned int negative:1;
172 unsigned int empty:16;
173 unsigned int mantissa0:30;
174 unsigned int quiet_nan:1;
176 unsigned int mantissa1:32;
178 unsigned int mantissa1:32;
179 unsigned int mantissa0:30;
180 unsigned int quiet_nan:1;
182 unsigned int exponent:15;
183 unsigned int negative:1;
184 unsigned int empty:16;
190 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
195 #undef __FLOAT_WORD_ORDER
198 #endif /* ieee754.h */