TGAMMASection: libc math functions (3)Updated: 2002-08-10 |
TGAMMASection: libc math functions (3)Updated: 2002-08-10 |
double tgamma(double x);
float tgammaf(float x);
long double tgammal(long double x);
Gamma(x) = integral from 0 to infinity of t^(x-1) e^-t dt
It is defined for every real number except for nonpositive integers. For nonnegative integral m one has
Gamma(m+1) = m!
and, more generally, for all x:
Gamma(x+1) = x * Gamma(x)
For x < 0.5 one can use
Gamma(x) * Gamma(1-x) = PI/sin(PI*x)
This function returns the value of the Gamma function for the argument x. It had to be called "true gamma function" since there is already a function gamma() that returns something else.
A range error occurs if x is too large. A pole error occurs if x is zero. A domain error (or a pole error) occurs if x is a negative integer.