|
|
1.1 ! root 1: /* ! 2: * @(#)tanh.c 5.1 (Berkeley) 11/3/86 ! 3: */ ! 4: ! 5: /* ! 6: tanh(arg) computes the hyperbolic tangent of its floating ! 7: point argument. ! 8: ! 9: sinh and cosh are called except for large arguments, which ! 10: would cause overflow improperly. ! 11: */ ! 12: ! 13: double sinh(), cosh(); ! 14: ! 15: double ! 16: tanh(arg) ! 17: double arg; ! 18: { ! 19: double sign; ! 20: ! 21: sign = 1.; ! 22: if(arg < 0.){ ! 23: arg = -arg; ! 24: sign = -1.; ! 25: } ! 26: ! 27: if(arg > 21.) ! 28: return(sign); ! 29: ! 30: return(sign*sinh(arg)/cosh(arg)); ! 31: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.