childs -> children.
[AROS.git] / workbench / libs / mathieeesingtrans / ieeespsinh.c
blob67293110dfa4e65716e15daf8835087e3b57ccdd
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathieeesingtrans_intern.h"
8 /*
9 FUNCTION
10 Calculate the hyperbolic sine of the IEEE single precision number
12 RESULT
13 IEEE single precision floating point number
15 flags:
16 zero : result is zero
17 negative : result is negative
18 overflow : result is too big for IEEE single precsion format
20 NOTES
22 EXAMPLE
24 BUGS
26 SEE ALSO
28 INTERNALS
29 <code>
30 sinh(x) = (1/2)*( e^x- e^(-x) )
32 sinh( |x| >= 9 ) = (1/2) * (e^x);
33 </code>
34 HISTORY
37 AROS_LH1(float, IEEESPSinh,
38 AROS_LHA(float, y, D0),
39 struct Library *, MathIeeeSingTransBase, 10, MathIeeeSingTrans
42 AROS_LIBFUNC_INIT
44 LONG Res;
45 LONG y2 = y & (IEEESPMantisse_Mask + IEEESPExponent_Mask);
46 LONG tmp;
48 if ( IEEESP_Pinfty == y2)
50 SetSR(Overflow_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
51 return y;
54 /* sinh(-x) = -sinh(x) */
55 Res = IEEESPExp(y2);
57 if ( IEEESP_Pinfty == Res )
59 SetSR(Overflow_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
60 return Res;
63 if ( y2 < 0x41100000 )
65 /*
66 the following lines is neccessary or otherwise changes in
67 the defines/mathieeesing*.h-files would have to be made!
69 tmp = IEEESPDiv(one, Res);
70 Res = IEEESPAdd(Res, tmp | IEEESPSign_Mask );
72 /* Res = Res / 2 */
73 Res -= 0x00800000;
75 /* at this point Res has to be positive to be valid */
76 if ( Res <= 0)
78 SetSR(Zero_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
79 return (y & IEEESPSign_Mask);
82 if ( y < 0)
84 SetSR(Negative_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
85 return (Res | IEEESPSign_Mask);
88 return Res;
90 AROS_LIBFUNC_EXIT