2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathieeedoubtrans_intern.h"
10 Calculate hyperbolic tangens of the IEEE double precision number
13 IEEE double precision floating point number
17 negative : result is negative
18 overflow : (not possible)
31 tanh(x) = ----------------
39 AROS_LHQUAD1(double, IEEEDPTanh
,
40 AROS_LHAQUAD(double, y
, D0
, D1
),
41 struct MathIeeeDoubTransBase
*, MathIeeeDoubTransBase
, 12, MathIeeeDoubTrans
48 /* y2 = y & (IEEESPMantisse_Mask + IEEESPExponent_Mask ); */
53 (IEEEDPMantisse_Mask_Hi
+ IEEEDPExponent_Mask_Hi
),
54 (IEEEDPMantisse_Mask_Lo
+ IEEEDPExponent_Mask_Lo
)
57 if ( is_geqC(y2
, 0x40320000, 0x0) )
63 if ( is_lessSC(y
, 0x0, 0x0))
65 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
66 Set_Value64C(Res
, 0xbfefffff, 0xffffffff);
70 Set_Value64C(Res
, 0x3fefffff, 0xffffffff);
74 /* tanh(-x) = -tanh(x) */
77 Set_Value64C(One
, 0x3ff00000, 0x0);
80 tmp1
= IEEEDPDiv(One
, Res
);
81 Set_Value64(tmp2
, tmp1
);
82 OR64QC(tmp2
, IEEEDPSign_Mask_Hi
, IEEEDPSign_Mask_Lo
);
90 if (is_eqC(Res
, 0x0, 0x0) )
92 if (is_lessSC(y
, 0x0, 0x0))
96 Zero_Bit
| Negative_Bit
,
97 Zero_Bit
| Negative_Bit
| Overflow_Bit
102 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
107 /* Argument is negative -> result is negative */
108 if ( is_lessSC(y
, 0x0, 0x0))
110 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
111 OR64QC(Res
, IEEEDPSign_Mask_Hi
, IEEEDPSign_Mask_Lo
);