1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/test/include/ieeefp.h Tue Sep 18 08:58:23 2007 +0000
1.9 +#include <machine/ieeefp.h>
1.11 +/* FIXME FIXME FIXME:
1.12 + Neither of __ieee_{float,double}_shape_tape seem to be used anywhere
1.13 + except in libm/test. If that is the case, please delete these from here.
1.14 + If that is not the case, please insert documentation here describing why
1.15 + they're needed. */
1.17 +#ifdef __IEEE_BIG_ENDIAN
1.24 + unsigned int sign : 1;
1.25 + unsigned int exponent: 11;
1.26 + unsigned int fraction0:4;
1.27 + unsigned int fraction1:16;
1.28 + unsigned int fraction2:16;
1.29 + unsigned int fraction3:16;
1.34 + unsigned int sign : 1;
1.35 + unsigned int exponent: 11;
1.36 + unsigned int quiet:1;
1.37 + unsigned int function0:3;
1.38 + unsigned int function1:16;
1.39 + unsigned int function2:16;
1.40 + unsigned int function3:16;
1.44 + unsigned long msw;
1.45 + unsigned long lsw;
1.48 +} __ieee_double_shape_type;
1.52 +#ifdef __IEEE_LITTLE_ENDIAN
1.59 +#ifdef __SMALL_BITFIELDS
1.60 + unsigned int fraction3:16;
1.61 + unsigned int fraction2:16;
1.62 + unsigned int fraction1:16;
1.63 + unsigned int fraction0: 4;
1.65 + unsigned int fraction1:32;
1.66 + unsigned int fraction0:20;
1.68 + unsigned int exponent :11;
1.69 + unsigned int sign : 1;
1.73 +#ifdef __SMALL_BITFIELDS
1.74 + unsigned int function3:16;
1.75 + unsigned int function2:16;
1.76 + unsigned int function1:16;
1.77 + unsigned int function0:3;
1.79 + unsigned int function1:32;
1.80 + unsigned int function0:19;
1.82 + unsigned int quiet:1;
1.83 + unsigned int exponent: 11;
1.84 + unsigned int sign : 1;
1.88 + unsigned long lsw;
1.89 + unsigned long msw;
1.94 +} __ieee_double_shape_type;
1.98 +#ifdef __IEEE_BIG_ENDIAN
1.105 + unsigned int sign : 1;
1.106 + unsigned int exponent: 8;
1.107 + unsigned int fraction0: 7;
1.108 + unsigned int fraction1: 16;
1.112 + unsigned int sign:1;
1.113 + unsigned int exponent:8;
1.114 + unsigned int quiet:1;
1.115 + unsigned int function0:6;
1.116 + unsigned int function1:16;
1.120 +} __ieee_float_shape_type;
1.124 +#ifdef __IEEE_LITTLE_ENDIAN
1.131 + unsigned int fraction0: 7;
1.132 + unsigned int fraction1: 16;
1.133 + unsigned int exponent: 8;
1.134 + unsigned int sign : 1;
1.138 + unsigned int function1:16;
1.139 + unsigned int function0:6;
1.140 + unsigned int quiet:1;
1.141 + unsigned int exponent:8;
1.142 + unsigned int sign:1;
1.146 +} __ieee_float_shape_type;
1.154 +/* FLOATING ROUNDING */
1.156 +typedef int fp_rnd;
1.157 +#define FP_RN 0 /* Round to nearest */
1.158 +#define FP_RM 1 /* Round down */
1.159 +#define FP_RP 2 /* Round up */
1.160 +#define FP_RZ 3 /* Round to zero (trunate) */
1.162 +fp_rnd _EXFUN(fpgetround,(void));
1.163 +fp_rnd _EXFUN(fpsetround, (fp_rnd));
1.167 +typedef int fp_except;
1.168 +#define FP_X_INV 0x10 /* Invalid operation */
1.169 +#define FP_X_DX 0x80 /* Divide by zero */
1.170 +#define FP_X_OFL 0x04 /* Overflow exception */
1.171 +#define FP_X_UFL 0x02 /* Underflow exception */
1.172 +#define FP_X_IMP 0x01 /* imprecise exception */
1.174 +fp_except _EXFUN(fpgetmask,(void));
1.175 +fp_except _EXFUN(fpsetmask,(fp_except));
1.176 +fp_except _EXFUN(fpgetsticky,(void));
1.177 +fp_except _EXFUN(fpsetsticky, (fp_except));
1.179 +/* INTEGER ROUNDING */
1.181 +typedef int fp_rdi;
1.182 +#define FP_RDI_TOZ 0 /* Round to Zero */
1.183 +#define FP_RDI_RD 1 /* Follow float mode */
1.185 +fp_rdi _EXFUN(fpgetroundtoi,(void));
1.186 +fp_rdi _EXFUN(fpsetroundtoi,(fp_rdi));
1.188 +int _EXFUN(isnan, (double));
1.189 +int _EXFUN(isinf, (double));
1.190 +int _EXFUN(finite, (double));
1.194 +int _EXFUN(isnanf, (float));
1.195 +int _EXFUN(isinff, (float));
1.196 +int _EXFUN(finitef, (float));
1.198 +#define __IEEE_DBL_EXPBIAS 1023
1.199 +#define __IEEE_FLT_EXPBIAS 127
1.201 +#define __IEEE_DBL_EXPLEN 11
1.202 +#define __IEEE_FLT_EXPLEN 8
1.205 +#define __IEEE_DBL_FRACLEN (64 - (__IEEE_DBL_EXPLEN + 1))
1.206 +#define __IEEE_FLT_FRACLEN (32 - (__IEEE_FLT_EXPLEN + 1))
1.208 +#define __IEEE_DBL_MAXPOWTWO ((double)(1L << 32 - 2) * (1L << (32-11) - 32 + 1))
1.209 +#define __IEEE_FLT_MAXPOWTWO ((float)(1L << (32-8) - 1))
1.211 +#define __IEEE_DBL_NAN_EXP 0x7ff
1.212 +#define __IEEE_FLT_NAN_EXP 0xff
1.215 +#define isnanf(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \
1.216 + ((*(long *)&(x) & 0x007fffffL)!=0000000000L))
1.218 +#define isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \
1.219 + ((*(long *)&(x) & 0x007fffffL)==0000000000L))
1.221 +#define finitef(x) (((*(long *)&(x) & 0x7f800000L)!=0x7f800000L))
1.223 +#ifdef _DOUBLE_IS_32BITS
1.224 +#undef __IEEE_DBL_EXPBIAS
1.225 +#define __IEEE_DBL_EXPBIAS __IEEE_FLT_EXPBIAS
1.227 +#undef __IEEE_DBL_EXPLEN
1.228 +#define __IEEE_DBL_EXPLEN __IEEE_FLT_EXPLEN
1.230 +#undef __IEEE_DBL_FRACLEN
1.231 +#define __IEEE_DBL_FRACLEN __IEEE_FLT_FRACLEN
1.233 +#undef __IEEE_DBL_MAXPOWTWO
1.234 +#define __IEEE_DBL_MAXPOWTWO __IEEE_FLT_MAXPOWTWO
1.236 +#undef __IEEE_DBL_NAN_EXP
1.237 +#define __IEEE_DBL_NAN_EXP __IEEE_FLT_NAN_EXP
1.239 +#undef __ieee_double_shape_type
1.240 +#define __ieee_double_shape_type __ieee_float_shape_type
1.242 +#endif /* _DOUBLE_IS_32BITS */
1.244 +#endif /* _IEEE_FP_H_ */