about summary refs log tree commit diff
path: root/src/math/tgamma.c
blob: f3bbe370eea72633046dc5f5123cf2aff2197ce2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <math.h>

// FIXME: use lanczos approximation

double __lgamma_r(double, int *);

double tgamma(double x)
{
	int sign;
	double y;

	y = exp(__lgamma_r(x, &sign));
	if (sign < 0)
		y = -y;
	return y;
}