Bell 32V development
[unix-history] / usr / src / libF77 / sinh.c
CommitLineData
0c9e74ab
TL
1/*
2 sinh(arg) returns the hyperbolic sign of its floating-
3 point argument.
4
5 The exponential function is called for arguments
6 greater in magnitude than 0.5.
7 The result overflows and 'huge' is returned for
8 arguments greater than somewhat.
9
10 A series is used for arguments smaller in magnitude than 0.5.
11 The coeffieients are #2029 from Hart & Cheney. (20.36D)
12
13 cosh(arg) is computed from the exponential function for
14 all arguments.
15*/
16
17double exp();
18
19static double p0 -0.6307673640497716991184787251e+6;
20static double p1 -0.8991272022039509355398013511e+5;
21static double p2 -0.2894211355989563807284660366e+4;
22static double p3 -0.2630563213397497062819489e+2;
23static double q0 -0.6307673640497716991212077277e+6;
24static double q1 0.1521517378790019070696485176e+5;
25static double q2 -0.173678953558233699533450911e+3;
26static double q3 1.0;
27
28double
29sinh(arg) double arg; {
30
31 double sign, temp, argsq;
32
33 sign = 1;
34 if(arg < 0){
35 arg = - arg;
36 sign = -1;
37 }
38
39 if(arg > 21.){
40 temp = exp(arg)/2;
41 return(sign*temp);
42 }
43
44 if(arg > 0.5) {
45 temp = (exp(arg) - exp(-arg))/2;
46 return(sign*temp);
47 }
48
49 argsq = arg*arg;
50 temp = (((p3*argsq+p2)*argsq+p1)*argsq+p0)*arg;
51 temp = temp/(((q3*argsq+q2)*argsq+q1)*argsq+q0);
52 return(sign*temp);
53
54}
55
56double
57cosh(arg) double arg; {
58
59 double temp;
60
61 if(arg < 0)
62 arg = - arg;
63
64 if(arg > 21.){
65 temp = exp(arg)/2;
66 return(temp);
67 }
68
69 temp = (exp(arg) + exp(-arg))/2;
70 return(temp);
71}