Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <math.h>
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
12
tanh(double arg)
13
{
14
 
15
	if(arg < 0) {
16
		arg = -arg;
17
		if(arg > 21)
18
			return -1;
19
		return -sinh(arg)/cosh(arg);
20
	}
21
	if(arg > 21)
22
		return 1;
23
	return sinh(arg)/cosh(arg);
24
}