Research V7 development
[unix-history] / usr / src / libm / tanh.c
CommitLineData
5d130d40
RM
1/*
2 tanh(arg) computes the hyperbolic tangent of its floating
3 point argument.
4
5 sinh and cosh are called except for large arguments, which
6 would cause overflow improperly.
7*/
8
9double sinh(), cosh();
10
11double
12tanh(arg)
13double arg;
14{
15 double sign;
16
17 sign = 1.;
18 if(arg < 0.){
19 arg = -arg;
20 sign = -1.;
21 }
22
23 if(arg > 21.)
24 return(sign);
25
26 return(sign*sinh(arg)/cosh(arg));
27}