Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1882 | clevermous | 1 | /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ |
2 | #ifndef __dj_include_ieeefp_h_ |
||
3 | #define __dj_include_ieeefp_h_ |
||
4 | |||
5 | #ifdef __cplusplus |
||
6 | extern "C" { |
||
7 | #endif |
||
8 | |||
9 | #include |
||
10 | |||
11 | /* #include |
||
12 | #include |
||
13 | #if BYTE_ORDER == LITTLE_ENDIAN |
||
14 | # define __IEEE_LITTLE_ENDIAN |
||
15 | #endif |
||
16 | |||
17 | /* FLOATING ROUNDING */ |
||
18 | |||
19 | typedef int fp_rnd; |
||
20 | #define FP_RN 0 /* Round to nearest */ |
||
21 | #define FP_RM 1 /* Round down */ |
||
22 | #define FP_RP 2 /* Round up */ |
||
23 | #define FP_RZ 3 /* Round to zero (truncate) */ |
||
24 | |||
25 | fp_rnd _EXFUN(fpgetround,(void)); |
||
26 | fp_rnd _EXFUN(fpsetround, (fp_rnd)); |
||
27 | |||
28 | /* EXCEPTIONS */ |
||
29 | |||
30 | typedef int fp_except; |
||
31 | #define FP_X_INV 0x10 /* Invalid operation */ |
||
32 | #define FP_X_DX 0x80 /* Divide by zero */ |
||
33 | #define FP_X_OFL 0x04 /* Overflow exception */ |
||
34 | #define FP_X_UFL 0x02 /* Underflow exception */ |
||
35 | #define FP_X_IMP 0x01 /* Imprecise exception */ |
||
36 | |||
37 | fp_except _EXFUN(fpgetmask,(void)); |
||
38 | fp_except _EXFUN(fpsetmask,(fp_except)); |
||
39 | fp_except _EXFUN(fpgetsticky,(void)); |
||
40 | fp_except _EXFUN(fpsetsticky, (fp_except)); |
||
41 | |||
42 | /* INTEGER ROUNDING */ |
||
43 | |||
44 | typedef int fp_rdi; |
||
45 | #define FP_RDI_TOZ 0 /* Round to Zero */ |
||
46 | #define FP_RDI_RD 1 /* Follow float mode */ |
||
47 | |||
48 | fp_rdi _EXFUN(fpgetroundtoi,(void)); |
||
49 | fp_rdi _EXFUN(fpsetroundtoi,(fp_rdi)); |
||
50 | |||
51 | int _EXFUN(isnan, (double)); |
||
52 | int _EXFUN(isinf, (double)); |
||
53 | int _EXFUN(finite, (double)); |
||
54 | |||
55 | int _EXFUN(isnanf, (float)); |
||
56 | int _EXFUN(isinff, (float)); |
||
57 | int _EXFUN(finitef, (float)); |
||
58 | |||
59 | #define __IEEE_DBL_EXPBIAS 1023 |
||
60 | #define __IEEE_FLT_EXPBIAS 127 |
||
61 | |||
62 | #define __IEEE_DBL_EXPLEN 11 |
||
63 | #define __IEEE_FLT_EXPLEN 8 |
||
64 | |||
65 | |||
66 | #define __IEEE_DBL_FRACLEN (64 - (__IEEE_DBL_EXPLEN + 1)) |
||
67 | #define __IEEE_FLT_FRACLEN (32 - (__IEEE_FLT_EXPLEN + 1)) |
||
68 | |||
69 | #define __IEEE_DBL_MAXPOWTWO ((double)(1L << 32 - 2) * (1L << (32-11) - 32 + 1)) |
||
70 | #define __IEEE_FLT_MAXPOWTWO ((float)(1L << (32-8) - 1)) |
||
71 | |||
72 | #define __IEEE_DBL_NAN_EXP 0x7ff |
||
73 | #define __IEEE_FLT_NAN_EXP 0xff |
||
74 | |||
75 | |||
76 | #define isnanf(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ |
||
77 | ((*(long *)&(x) & 0x007fffffL)!=0000000000L)) |
||
78 | |||
79 | #define isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ |
||
80 | ((*(long *)&(x) & 0x007fffffL)==0000000000L)) |
||
81 | |||
82 | #define finitef(x) (((*(long *)&(x) & 0x7f800000L)!=0x7f800000L)) |
||
83 | |||
84 | #ifdef __cplusplus |
||
85 | } |
||
86 | #endif |
||
87 | |||
88 | #endif /* __dj_include_ieeefp_h_ */><>><>><> |