2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathieeedoubtrans_intern.h"
8 /*****************************************************************************
12 AROS_LHQUAD2(double, IEEEDPPow
,
15 AROS_LHAQUAD(double, x
, D2
, D3
),
16 AROS_LHAQUAD(double, y
, D0
, D1
),
19 struct MathIeeeDoubTransBase
*, MathIeeeDoubTransBase
, 15, MathIeeeDoubTrans
)
22 Calculate y raised to the x power (y^x)
27 IEEE double 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 (is_lessSC(y
, 0x0, 0x0) && is_neq(x
, IEEEDPCeil(x
)))
51 Set_Value64C(Res
, 0x0, 0x0);
55 if (is_eqC(y
, 0x0, 0x0))
57 Set_Value64C(Res
, 0x3ff00000, 0x0);
64 (IEEEDPMantisse_Mask_Hi
+ IEEEDPExponent_Mask_Hi
),
65 (IEEEDPMantisse_Mask_Lo
+ IEEEDPExponent_Mask_Lo
)
69 Res
= IEEEDPMul(Res
, x
);
73 if y < 0 and x was and even integer, the result is positive, otherwise
78 is_lessSC(y
, 0x0, 0x0)
79 && TRUE
== intern_IEEEDPisodd(x
)
82 OR64QC(Res
, IEEEDPSign_Mask_Hi
, IEEEDPSign_Mask_Lo
);
85 if (is_eqC(Res
, 0x0, 0x0))
87 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
88 Set_Value64C(Res
, 0x0, 0x0);
92 SetSR(0, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
94 if (is_lessSC(Res
, 0x0, 0x0))
96 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
99 Set_Value64(tmp
, Res
);
103 (IEEEDPMantisse_Mask_Hi
+ IEEEDPExponent_Mask_Hi
),
104 (IEEEDPMantisse_Mask_Lo
+ IEEEDPExponent_Mask_Lo
)
107 if (is_eqC(Res
, IEEEDPPInfty_Hi
, IEEEDPPInfty_Lo
))
109 /* don`t touch the Negative_Bit now!*/
110 SetSR(Overflow_Bit
, Zero_Bit
| Overflow_Bit
);