Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / mathtrans / sppow.c
blobf52ee6c542e329e4e84043e4411581a46f0e6176
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathtrans_intern.h"
8 /*
9 FUNCTION
10 Calculate fnum2 raised to the fnum1 power (fnum2^fnum1)
12 RESULT
13 Motorola fast floating point number
15 flags:
16 zero : result is zero
17 negative : result is negative
18 overflow : result is too big
20 NOTES
22 EXAMPLE
24 BUGS
26 SEE ALSO
28 INTERNALS
30 HISTORY
33 AROS_LH2(float, SPPow,
34 AROS_LHA(float, fnum1, D1),
35 AROS_LHA(float, fnum2, D0),
36 struct Library *, MathTransBase, 15, MathTrans
39 AROS_LIBFUNC_INIT
41 /*
42 a ^ b = e^(b * ln a )
43 fnum2 ^ fnum1 = e^(fnum1 * ln fnum2)
46 ULONG Res;
47 Res = SPLog( fnum2 & (FFPMantisse_Mask + FFPExponent_Mask) );
48 Res = SPMul(Res, fnum1);
49 Res = SPExp(Res);
51 if (0 == Res)
53 SetSR(Zero_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
54 return 0;
57 if ((char) Res < 0)
59 SetSR(Negative_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
62 return Res;
64 AROS_LIBFUNC_EXIT