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
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 negative
:1;
139 unsigned int exponent
:15;
140 unsigned int empty
:16;
141 unsigned int mantissa0
:32;
142 unsigned int mantissa1
:32;
144 #if __BYTE_ORDER == __LITTLE_ENDIAN
145 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
146 unsigned int exponent
:15;
147 unsigned int negative
:1;
148 unsigned int empty
:16;
149 unsigned int mantissa0
:32;
150 unsigned int mantissa1
:32;
152 unsigned int mantissa1
:32;
153 unsigned int mantissa0
:32;
154 unsigned int exponent
:15;
155 unsigned int negative
:1;
156 unsigned int empty
:16;
161 /* This is for NaNs in the IEEE 854 double-extended-precision format. */
164 #if __BYTE_ORDER == __BIG_ENDIAN
165 unsigned int negative
:1;
166 unsigned int exponent
:15;
167 unsigned int empty
:16;
169 unsigned int quiet_nan
:1;
170 unsigned int mantissa0
:30;
171 unsigned int mantissa1
:32;
173 #if __BYTE_ORDER == __LITTLE_ENDIAN
174 # if __FLOAT_WORD_ORDER == __BIG_ENDIAN
175 unsigned int exponent
:15;
176 unsigned int negative
:1;
177 unsigned int empty
:16;
178 unsigned int mantissa0
:30;
179 unsigned int quiet_nan
:1;
181 unsigned int mantissa1
:32;
183 unsigned int mantissa1
:32;
184 unsigned int mantissa0
:30;
185 unsigned int quiet_nan
:1;
187 unsigned int exponent
:15;
188 unsigned int negative
:1;
189 unsigned int empty
:16;
195 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
199 #endif /* ieee754.h */