2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathtrans_intern.h"
10 Calculate hyperbolic tangens of the ffp number
13 Motorola fast floating point number
17 negative : result is negative
18 overflow : (not possible)
32 tanh(x) = ----------------
41 AROS_LH1(float, SPTanh
,
42 AROS_LHA(float, fnum1
, D0
),
43 struct Library
*, MathTransBase
, 12, MathTrans
51 tmp
= (fnum1
& FFPExponent_Mask
) - 0x41;
53 if ( tmp
>= 3 && (fnum1
& FFPMantisse_Mask
) >= 0x90000000 )
59 return (one
| ( fnum1
& FFPSign_Mask
));
62 /* tanh(-x) = -tanh(x) */
63 Res
= SPExp(fnum1
& (FFPMantisse_Mask
+ FFPExponent_Mask
));
66 SPAdd(Res
, SPDiv(Res
, one
)),
67 SPAdd(Res
, (ULONG
)SPDiv(Res
, one
) | FFPSign_Mask
)
73 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
77 /* Argument is negative -> result is negative */
78 if ( (char) fnum1
< 0)
80 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
81 return (Res
| FFPSign_Mask
);