2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathieeedoubtrans_intern.h"
10 Calculate the hyperbolic cosine of the IEEE single precision number
13 IEEE single precision floating point number
17 negative : 0 (not possible)
18 overflow : result too big for ffp-number
29 cosh(x) = (1/2)*( e^x + e^(-x) )
31 cosh( |x| >= 18 ) = (1/2) * (e^x);
36 AROS_LHQUAD1(double, IEEEDPCosh
,
37 AROS_LHAQUAD(double, y
, D0
, D1
),
38 struct MathIeeeDoubTransBase
*, MathIeeeDoubTransBase
, 11, MathIeeeDoubTrans
44 /* cosh(-x) = cosh(x) */
45 /* y &= ( IEEEDPMantisse_Mask + IEEEDPExponent_Mask ); */
49 (IEEEDPMantisse_Mask_Hi
+ IEEEDPExponent_Mask_Hi
),
50 (IEEEDPMantisse_Mask_Lo
+ IEEEDPExponent_Mask_Lo
)
53 if ( is_eqC(y
, IEEEDPPInfty_Hi
, IEEEDPPInfty_Lo
))
55 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
61 if ( is_eqC(Res
, IEEEDPPInfty_Hi
, IEEEDPPInfty_Lo
))
63 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
67 /* does adding of 1/(e^x) still change the result? */
68 if ( is_lessC(y
, 0x40320000, 0x0 ))
71 Set_Value64C(One
, 0x3ff00000, 0x0);
73 Res
= IEEEDPAdd(Res
, IEEEDPDiv(One
, Res
));
76 ADD64QC(Res
, 0xFFF00000, 0x0);
81 || is_lessSC(Res
, 0x0, 0x0)
84 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
85 Set_Value64C(Res
, 0x0, 0x0);