2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathieeedoubtrans_intern.h"
8 /*****************************************************************************
12 AROS_LHQUAD1(double, IEEEDPCosh
,
15 AROS_LHAQUAD(double, y
, D0
, D1
),
18 struct MathIeeeDoubTransBase
*, MathIeeeDoubTransBase
, 11, MathIeeeDoubTrans
)
21 Calculate the hyperbolic cosine of the IEEE single precision number
26 IEEE single precision 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| >= 18 ) = (1/2) * (e^x);
40 *****************************************************************************/
45 /* cosh(-x) = cosh(x) */
46 /* y &= ( IEEEDPMantisse_Mask + IEEEDPExponent_Mask ); */
50 (IEEEDPMantisse_Mask_Hi
+ IEEEDPExponent_Mask_Hi
),
51 (IEEEDPMantisse_Mask_Lo
+ IEEEDPExponent_Mask_Lo
)
54 if ( is_eqC(y
, IEEEDPPInfty_Hi
, IEEEDPPInfty_Lo
))
56 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
62 if ( is_eqC(Res
, IEEEDPPInfty_Hi
, IEEEDPPInfty_Lo
))
64 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
68 /* does adding of 1/(e^x) still change the result? */
69 if ( is_lessC(y
, 0x40320000, 0x0 ))
72 Set_Value64C(One
, 0x3ff00000, 0x0);
74 Res
= IEEEDPAdd(Res
, IEEEDPDiv(One
, Res
));
77 ADD64QC(Res
, 0xFFF00000, 0x0);
82 || is_lessSC(Res
, 0x0, 0x0)
85 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
86 Set_Value64C(Res
, 0x0, 0x0);