2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathieeesingtrans_intern.h"
8 /*****************************************************************************
12 AROS_LH1(float, IEEESPTanh
,
15 AROS_LHA(float, y
, D0
),
18 struct Library
*, MathIeeeSingTransBase
, 12, MathIeeeSingTrans
)
21 Calculate hyperbolic tangens of the IEEE single precision number
26 IEEE single precision floating point number
30 negative : result is negative
31 overflow : (not possible)
37 *****************************************************************************/
42 LONG y2
= y
& (IEEESPMantisse_Mask
+ IEEESPExponent_Mask
);
45 if ( y2
>= 0x41100000 )
50 return (one
| ( y
& IEEESPSign_Mask
));
52 /* tanh(-x) = -tanh(x) */
54 tmp
= IEEESPDiv(one
, Res
);
57 IEEESPAdd(Res
, (tmp
| IEEESPSign_Mask
) ),
66 SetSR(Zero_Bit
| Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
70 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
73 return (y
& IEEESPSign_Mask
);
76 /* Argument is negative -> result is negative */
79 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
80 return (Res
| IEEESPSign_Mask
);