You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
366 B
26 lines
366 B
#include <soft.h>
|
|
|
|
/*
|
|
tanh(arg) computes the hyperbolic tangent of its floating
|
|
point argument.
|
|
|
|
sinh and cosh are called except for large arguments, which
|
|
would cause overflow improperly.
|
|
*/
|
|
|
|
double tanh(double arg)
|
|
{
|
|
double sign;
|
|
|
|
sign = 1.;
|
|
if(arg < 0.){
|
|
arg = -arg;
|
|
sign = -1.;
|
|
}
|
|
|
|
if(arg > 21.)
|
|
return(sign);
|
|
|
|
return(sign*sinh(arg)/cosh(arg));
|
|
}
|