tgamma.c 210 字节
Newer Older
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;
}