Name

tgamma, tgammaf, tgammal — true gamma function

Synopsis

#include <math.h>
double tgamma( double   x);
float tgammaf( float   x);
long double tgammal( long double   x);
[Note] Note
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
tgamma(), tgammaf(), tgammal():
_XOPEN_SOURCE >= 600 || _ISOC99_SOURCE;
or cc -std=c99
[Note] Note

Link with −lm.

DESCRIPTION

The Gamma function is defined by

Gamma(x) = integral from 0 to infinity of t^(x−1) e^−t dt

It is defined for every real number except for non-positive integers. For non-negative integral m one has

Gamma(m+1) = m!

and, more generally, for all x:

Gamma(x+1) = x * Gamma(x)

Furthermore, the following is valid for all values of x outside the poles:

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(3) that returns something else.

ERRORS

In order to check for errors, set errno to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these functions. On return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.

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.

CONFORMING TO

C99.

SEE ALSO

gamma(3), lgamma(3)

COLOPHON

This page is part of release 2.79 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.


  Copyright 2002 Walter Harms (walter.harmsinformatik.uni-oldenburg.de)
Distributed under GPL
Based on glibc infopages
Modified 2004-11-15, fixed error noted by Fabian Kreutz
 <kreutzdbs.uni-hannover.de>