Commit | Line | Data |
---|---|---|
94759b7b TL |
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 | ||
9 | double sinh(), cosh(); | |
10 | ||
11 | double | |
12 | tanh(arg) | |
13 | double 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 | } |