revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / mathieeesingtrans / ieeespsinh.c
blob23444312f3e821f0b8d16f4f0657e703ee8a3201
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathieeesingtrans_intern.h"
8 /*****************************************************************************
10 NAME */
12 AROS_LH1(float, IEEESPSinh,
14 /* SYNOPSIS */
15 AROS_LHA(float, y, D0),
17 /* LOCATION */
18 struct Library *, MathIeeeSingTransBase, 10, MathIeeeSingTrans)
20 /* FUNCTION
21 Calculate the hyperbolic sine of the IEEE single precision number
23 INPUTS
25 RESULT
26 IEEE single precision floating point number
28 flags:
29 zero : result is zero
30 negative : result is negative
31 overflow : result is too big for IEEE single precsion format
33 BUGS
35 INTERNALS
36 sinh(x) = (1/2)*( e^x- e^(-x) )
38 sinh( |x| >= 9 ) = (1/2) * (e^x);
40 *****************************************************************************/
43 AROS_LIBFUNC_INIT
45 LONG Res;
46 LONG y2 = y & (IEEESPMantisse_Mask + IEEESPExponent_Mask);
47 LONG tmp;
49 if ( IEEESP_Pinfty == y2)
51 SetSR(Overflow_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
52 return y;
55 /* sinh(-x) = -sinh(x) */
56 Res = IEEESPExp(y2);
58 if ( IEEESP_Pinfty == Res )
60 SetSR(Overflow_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
61 return Res;
64 if ( y2 < 0x41100000 )
66 /*
67 the following lines is neccessary or otherwise changes in
68 the defines/mathieeesing*.h-files would have to be made!
70 tmp = IEEESPDiv(one, Res);
71 Res = IEEESPAdd(Res, tmp | IEEESPSign_Mask );
73 /* Res = Res / 2 */
74 Res -= 0x00800000;
76 /* at this point Res has to be positive to be valid */
77 if ( Res <= 0)
79 SetSR(Zero_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
80 return (y & IEEESPSign_Mask);
83 if ( y < 0)
85 SetSR(Negative_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
86 return (Res | IEEESPSign_Mask);
89 return Res;
91 AROS_LIBFUNC_EXIT