2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathieeesingtrans_intern.h"
8 /*****************************************************************************
12 AROS_LH2(float, IEEESPPow
,
15 AROS_LHA(float, x
, D1
),
16 AROS_LHA(float, y
, D0
),
19 struct Library
*, MathIeeeSingTransBase
, 15, MathIeeeSingTrans
)
22 Calculate y raised to the x power (y^x)
27 IEEE single precision floating point number
31 negative : result is negative
32 overflow : result is too big
38 *****************************************************************************/
48 /* y^x is illegal if y<0 and x is not an integer-value */
49 if (y
< 0 && x
!= IEEESPCeil(x
) ) return 0;
51 Res
= IEEESPLog( y
& (IEEESPMantisse_Mask
+ IEEESPExponent_Mask
) );
52 Res
= IEEESPMul(Res
, x
);
56 if y < 0 and x was and even integer, the result is positive, otherwise
59 if (y
< 0 && TRUE
== intern_IEEESPisodd(x
) ) Res
|= IEEESPSign_Mask
;
63 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
67 SetSR(0, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
71 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
74 if ( IEEESP_Pinfty
== (Res
& (IEEESPMantisse_Mask
+ IEEESPExponent_Mask
)) )
76 /* don`t touch the Negative_Bit now!*/
77 SetSR(Overflow_Bit
, Zero_Bit
| Overflow_Bit
);