2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathieeedoubtrans_intern.h"
10 Calculate y raised to the x power (y^x)
13 IEEE double precision floating point number
17 negative : result is negative
18 overflow : result is too big
33 AROS_LHQUAD2(double, IEEEDPPow
,
34 AROS_LHAQUAD(double, x
, D2
, D3
),
35 AROS_LHAQUAD(double, y
, D0
, D1
),
36 struct MathIeeeDoubTransBase
*, MathIeeeDoubTransBase
, 15, MathIeeeDoubTrans
47 /* y^x is illegal if y<0 and x is not an integer-value */
48 if (is_lessSC(y
, 0x0, 0x0) && is_neq(x
, IEEEDPCeil(x
)))
50 Set_Value64C(Res
, 0x0, 0x0);
54 if (is_eqC(y
, 0x0, 0x0))
56 Set_Value64C(Res
, 0x3ff00000, 0x0);
63 (IEEEDPMantisse_Mask_Hi
+ IEEEDPExponent_Mask_Hi
),
64 (IEEEDPMantisse_Mask_Lo
+ IEEEDPExponent_Mask_Lo
)
68 Res
= IEEEDPMul(Res
, x
);
72 if y < 0 and x was and even integer, the result is positive, otherwise
77 is_lessSC(y
, 0x0, 0x0)
78 && TRUE
== intern_IEEEDPisodd(x
)
81 OR64QC(Res
, IEEEDPSign_Mask_Hi
, IEEEDPSign_Mask_Lo
);
84 if (is_eqC(Res
, 0x0, 0x0))
86 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
87 Set_Value64C(Res
, 0x0, 0x0);
91 SetSR(0, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
93 if (is_lessSC(Res
, 0x0, 0x0))
95 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
98 Set_Value64(tmp
, Res
);
102 (IEEEDPMantisse_Mask_Hi
+ IEEEDPExponent_Mask_Hi
),
103 (IEEEDPMantisse_Mask_Lo
+ IEEEDPExponent_Mask_Lo
)
106 if (is_eqC(Res
, IEEEDPPInfty_Hi
, IEEEDPPInfty_Lo
))
108 /* don`t touch the Negative_Bit now!*/
109 SetSR(Overflow_Bit
, Zero_Bit
| Overflow_Bit
);