2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathtrans_intern.h"
8 /*****************************************************************************
12 AROS_LH1(float, SPCosh
,
15 AROS_LHA(float, fnum1
, D0
),
18 struct Library
*, MathTransBase
, 11, MathTrans
)
21 Calculate the hyperbolic cosine of the ffp number
26 Motorola fast floating point number
30 negative : 0 (not possible)
31 overflow : result too big for ffp-number
36 cosh(x) = (1/2)*( e^x + e^(-x) )
38 cosh( |x| >= 44 ) = infinity;
39 cosh( |x| >= 9 ) = (1/2) * (e^x);
41 *****************************************************************************/
48 /* cosh(-x) = cosh(x) */
49 fnum1
&= ( FFPMantisse_Mask
+ FFPExponent_Mask
);
53 if ( FFP_Pinfty
== Res
)
55 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
59 tmp
= (fnum1
& FFPExponent_Mask
) - 0x41;
61 if ( tmp
<= 2 || (tmp
== 3 && (fnum1
& FFPMantisse_Mask
) < 0x90000000) )
63 Res
= SPAdd(Res
, SPDiv(Res
, one
));
67 /* should be ((char)Res) --, but gcc on Linux screws up the result */
68 tmp
= Res
& 0xFFFFFF00;
72 if (0 == Res
|| (char)Res
< 0 )
74 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);