2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
34 #include <machine/ieeefp.h>
36 /* FIX THIS FIX THIS FIX THIS:
37 Neither of __ieee_{float,double}_shape_tape seem to be used anywhere
38 except in libm/test. If that is the case, please delete these from here.
39 If that is not the case, please insert documentation here describing why
42 #ifdef __IEEE_BIG_ENDIAN
49 unsigned int sign : 1;
50 unsigned int exponent: 11;
51 unsigned int fraction0:4;
52 unsigned int fraction1:16;
53 unsigned int fraction2:16;
54 unsigned int fraction3:16;
59 unsigned int sign : 1;
60 unsigned int exponent: 11;
62 unsigned int function0:3;
63 unsigned int function1:16;
64 unsigned int function2:16;
65 unsigned int function3:16;
73 } __ieee_double_shape_type;
77 #ifdef __IEEE_LITTLE_ENDIAN
84 #ifdef __SMALL_BITFIELDS
85 unsigned int fraction3:16;
86 unsigned int fraction2:16;
87 unsigned int fraction1:16;
88 unsigned int fraction0: 4;
90 unsigned int fraction1:32;
91 unsigned int fraction0:20;
93 unsigned int exponent :11;
94 unsigned int sign : 1;
98 #ifdef __SMALL_BITFIELDS
99 unsigned int function3:16;
100 unsigned int function2:16;
101 unsigned int function1:16;
102 unsigned int function0:3;
104 unsigned int function1:32;
105 unsigned int function0:19;
107 unsigned int quiet:1;
108 unsigned int exponent: 11;
109 unsigned int sign : 1;
119 } __ieee_double_shape_type;
123 #ifdef __IEEE_BIG_ENDIAN
130 unsigned int sign : 1;
131 unsigned int exponent: 8;
132 unsigned int fraction0: 7;
133 unsigned int fraction1: 16;
138 unsigned int exponent:8;
139 unsigned int quiet:1;
140 unsigned int function0:6;
141 unsigned int function1:16;
145 } __ieee_float_shape_type;
149 #ifdef __IEEE_LITTLE_ENDIAN
156 unsigned int fraction0: 7;
157 unsigned int fraction1: 16;
158 unsigned int exponent: 8;
159 unsigned int sign : 1;
163 unsigned int function1:16;
164 unsigned int function0:6;
165 unsigned int quiet:1;
166 unsigned int exponent:8;
171 } __ieee_float_shape_type;
181 #define FP_RN 0 /* Round to nearest */
182 #define FP_RM 1 /* Round down */
183 #define FP_RP 2 /* Round up */
184 #define FP_RZ 3 /* Round to zero (trunate) */
186 fp_rnd fpgetround(void);
187 fp_rnd fpsetround(fp_rnd);
192 typedef int fp_except;
194 #define FP_X_INV 0x10 /* Invalid operation */
195 #define FP_X_DX 0x80 /* Divide by zero */
196 #define FP_X_OFL 0x04 /* Overflow exception */
197 #define FP_X_UFL 0x02 /* Underflow exception */
198 #define FP_X_IMP 0x01 /* imprecise exception */
200 fp_except fpgetmask(void);
201 fp_except fpsetmask(fp_except);
202 fp_except fpgetsticky(void);
203 fp_except fpsetsticky(fp_except);
209 #define FP_RDI_TOZ 0 /* Round to Zero */
210 #define FP_RDI_RD 1 /* Follow float mode */
212 fp_rdi fpgetroundtoi(void);
213 fp_rdi fpsetroundtoi(fp_rdi);
223 #define __IEEE_DBL_EXPBIAS 1023
224 #define __IEEE_FLT_EXPBIAS 127
225 #define __IEEE_DBL_EXPLEN 11
226 #define __IEEE_FLT_EXPLEN 8
227 #define __IEEE_DBL_FRACLEN (64 - (__IEEE_DBL_EXPLEN + 1))
228 #define __IEEE_FLT_FRACLEN (32 - (__IEEE_FLT_EXPLEN + 1))
229 #define __IEEE_DBL_MAXPOWTWO ((double)(1L << 32 - 2) * (1L << (32-11) - 32 + 1))
230 #define __IEEE_FLT_MAXPOWTWO ((float)(1L << (32-8) - 1))
231 #define __IEEE_DBL_NAN_EXP 0x7ff
232 #define __IEEE_FLT_NAN_EXP 0xff
234 #define isnanf(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \
235 ((*(long *)&(x) & 0x007fffffL)!=0000000000L))
236 #define isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \
237 ((*(long *)&(x) & 0x007fffffL)==0000000000L))
238 #define finitef(x) (((*(long *)&(x) & 0x7f800000L)!=0x7f800000L))
240 #endif /* _IEEE_FP_H_ */