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