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/planix-v0/sys/src/libc/port/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 <u.h>
2
#include <libc.h>
3
 
4
/*
5
	tanh(arg) computes the hyperbolic tangent of its floating
6
	point argument.
7
 
8
	sinh and cosh are called except for large arguments, which
9
	would cause overflow improperly.
10
 */
11
 
12
double
13
tanh(double arg)
14
{
15
 
16
	if(arg < 0) {
17
		arg = -arg;
18
		if(arg > 21)
19
			return -1;
20
		return -sinh(arg)/cosh(arg);
21
	}
22
	if(arg > 21)
23
		return 1;
24
	return sinh(arg)/cosh(arg);
25
}