2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathieeesingtrans_intern.h"
8 /*****************************************************************************
12 AROS_LH1(float, IEEESPExp
,
15 AROS_LHA(float, y
, D0
),
18 struct Library
*, MathIeeeSingTransBase
, 13, MathIeeeSingTrans
)
28 IEEE single precision number
33 overflow : the result was out of range for the IEEE single precision
37 e^(>= 89): return 0x7f800000;
38 e^(2^(<=-24)): return one;
40 *****************************************************************************/
44 const LONG ExpTable
[] =
46 0x6da12cc2, /* e^64 */
47 0x568fa1fe, /* e^32 */
48 0x4b07975e, /* e^16 */
53 0x3fd3094c, /* e^(1/2) */
54 0x3fa45af2, /* e^(1/4) */
55 0x3f910b02, /* e^(1/8) */
56 0x3f88415b, /* e^(1/16) */
57 0x3f84102b, /* e^(1/32) */
58 0x3f820405, /* e^(1/64) */
59 0x3f810101, /* e^(1/128) */
60 0x3f808040, /* e^(1/256) */
61 0x3f804010, /* e^(1/512) */
62 0x3f802004, /* e^(1/1024) */
63 0x3f801001, /* e^(1/2048) */
64 0x3f800800, /* e^(1/4096) */
65 0x3f800400, /* e^(1/8192) */
66 0x3f800200, /* e^(1/16384) */
67 0x3f800100, /* e^(1/32768) */
68 0x3f800080, /* e^(1/65536) */
69 0x3f800040, /* e^(1/131072) */
70 0x3f800020, /* e^(1/262144) */
71 0x3f800010, /* e^(1/524288) */
72 0x3f800008, /* e^(1/1048576) */
73 0x3f800004, /* e^(1/2097152) */
74 0x3f800002, /* e^(1/4194304) */
75 0x3f800001, /* e^(1/8388608) */
81 Exponent
= ((y
& IEEESPExponent_Mask
) >> 23) -0x7f;
83 /* e^0 = 1, e^(2^(<=-24)) = 1 */
84 if ( 0 == y
|| Exponent
<= -24 ) return one
;
86 /* e^(>= 89) = overflow) */
89 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
95 Mantisse
= (y
& IEEESPMantisse_Mask
) << 9;
98 while ( 0 != Mantisse
&& i
<= 29 )
100 /* is the highest bit set? */
103 Res
= IEEESPMul(Res
, ExpTable
[i
]);
106 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
109 if (IEEESP_Pinfty
== Res
)
111 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
119 if ( y
< 0) return IEEESPDiv(one
, Res
);