Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_posix/sys/src/ape/lib/ap/math/tanh.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | 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
}