2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathieeesingtrans_intern.h"
10 Calculate hyperbolic tangens of the IEEE single precision number
13 IEEE single precision floating point number
17 negative : result is negative
18 overflow : (not possible)
32 tanh(x) = ----------------
41 AROS_LH1(float, IEEESPTanh
,
42 AROS_LHA(float, y
, D0
),
43 struct Library
*, MathIeeeSingTransBase
, 12, MathIeeeSingTrans
49 LONG y2
= y
& (IEEESPMantisse_Mask
+ IEEESPExponent_Mask
);
52 if ( y2
>= 0x41100000 )
57 return (one
| ( y
& IEEESPSign_Mask
));
59 /* tanh(-x) = -tanh(x) */
61 tmp
= IEEESPDiv(one
, Res
);
64 IEEESPAdd(Res
, (tmp
| IEEESPSign_Mask
) ),
73 SetSR(Zero_Bit
| Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
77 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
80 return (y
& IEEESPSign_Mask
);
83 /* Argument is negative -> result is negative */
86 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
87 return (Res
| IEEESPSign_Mask
);