1 /* Copyright (C) 2000 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
32 /* This is the IEEE 754 single-precision format. */
35 #if __BYTE_ORDER == __BIG_ENDIAN
36 unsigned int negative
:1;
37 unsigned int exponent
:8;
38 unsigned int mantissa
:23;
39 #endif /* Big endian. */
40 #if __BYTE_ORDER == __LITTLE_ENDIAN
41 unsigned int mantissa
:23;
42 unsigned int exponent
:8;
43 unsigned int negative
:1;
44 #endif /* Little endian. */
47 /* This format makes it easier to see if a NaN is a signalling NaN. */
50 #if __BYTE_ORDER == __BIG_ENDIAN
51 unsigned int negative
:1;
52 unsigned int exponent
:8;
53 unsigned int quiet_nan
:1;
54 unsigned int mantissa
:22;
55 #endif /* Big endian. */
56 #if __BYTE_ORDER == __LITTLE_ENDIAN
57 unsigned int mantissa
:22;
58 unsigned int quiet_nan
:1;
59 unsigned int exponent
:8;
60 unsigned int negative
:1;
61 #endif /* Little endian. */
65 #define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */
72 /* This is the IEEE 754 double-precision format. */
75 #if __BYTE_ORDER == __BIG_ENDIAN
76 unsigned int negative
:1;
77 unsigned int exponent
:11;
78 /* Together these comprise the mantissa. */
79 unsigned int mantissa0
:20;
80 unsigned int mantissa1
:32;
81 #endif /* Big endian. */
82 #if __BYTE_ORDER == __LITTLE_ENDIAN
83 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
84 unsigned int mantissa0
:20;
85 unsigned int exponent
:11;
86 unsigned int negative
:1;
87 unsigned int mantissa1
:32;
89 /* Together these comprise the mantissa. */
90 unsigned int mantissa1
:32;
91 unsigned int mantissa0
:20;
92 unsigned int exponent
:11;
93 unsigned int negative
:1;
95 #endif /* Little endian. */
98 /* This format makes it easier to see if a NaN is a signalling NaN. */
101 #if __BYTE_ORDER == __BIG_ENDIAN
102 unsigned int negative
:1;
103 unsigned int exponent
:11;
104 unsigned int quiet_nan
:1;
105 /* Together these comprise the mantissa. */
106 unsigned int mantissa0
:19;
107 unsigned int mantissa1
:32;
109 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
110 unsigned int mantissa0
:19;
111 unsigned int quiet_nan
:1;
112 unsigned int exponent
:11;
113 unsigned int negative
:1;
114 unsigned int mantissa1
:32;
116 /* Together these comprise the mantissa. */
117 unsigned int mantissa1
:32;
118 unsigned int mantissa0
:19;
119 unsigned int quiet_nan
:1;
120 unsigned int exponent
:11;
121 unsigned int negative
:1;
127 #define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
130 union ieee854_long_double
134 /* This is the IEEE 854 double-extended-precision format. */
137 #if __BYTE_ORDER == __BIG_ENDIAN
138 unsigned int empty0
:32;
139 unsigned int negative
:1;
140 unsigned int exponent
:15;
141 unsigned int empty1
:16;
142 unsigned int mantissa0
:32;
143 unsigned int mantissa1
:32;
145 #if __BYTE_ORDER == __LITTLE_ENDIAN
146 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
147 unsigned int empty0
:32;
148 unsigned int exponent
:15;
149 unsigned int negative
:1;
150 unsigned int empty1
:16;
151 unsigned int mantissa0
:32;
152 unsigned int mantissa1
:32;
154 unsigned int mantissa1
:32;
155 unsigned int mantissa0
:32;
156 unsigned int exponent
:15;
157 unsigned int negative
:1;
158 unsigned int empty1
:16;
159 unsigned int empty0
:32;
164 /* This is for NaNs in the IEEE 854 double-extended-precision format. */
167 #if __BYTE_ORDER == __BIG_ENDIAN
168 unsigned int empty0
:32;
169 unsigned int negative
:1;
170 unsigned int exponent
:15;
171 unsigned int empty1
:16;
173 unsigned int quiet_nan
:1;
174 unsigned int mantissa0
:30;
175 unsigned int mantissa1
:32;
177 #if __BYTE_ORDER == __LITTLE_ENDIAN
178 # if __FLOAT_WORD_ORDER == BIG_ENDIAN
179 unsigned int empty0
:32;
180 unsigned int exponent
:15;
181 unsigned int negative
:1;
182 unsigned int empty1
:16;
183 unsigned int mantissa0
:30;
184 unsigned int quiet_nan
:1;
186 unsigned int mantissa1
:32;
188 unsigned int mantissa1
:32;
189 unsigned int mantissa0
:30;
190 unsigned int quiet_nan
:1;
192 unsigned int exponent
:15;
193 unsigned int negative
:1;
194 unsigned int empty1
:16;
195 unsigned int empty0
:32;
201 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
205 #endif /* ieee754.h */