1 /* @(#)tanh.c 4.1 12/25/82 */ 2 3 /* 4 tanh(arg) computes the hyperbolic tangent of its floating 5 point argument. 6 7 sinh and cosh are called except for large arguments, which 8 would cause overflow improperly. 9 */ 10 11 double sinh(), cosh(); 12 13 double 14 tanh(arg) 15 double arg; 16 { 17 double sign; 18 19 sign = 1.; 20 if(arg < 0.){ 21 arg = -arg; 22 sign = -1.; 23 } 24 25 if(arg > 21.) 26 return(sign); 27 28 return(sign*sinh(arg)/cosh(arg)); 29 } 30