Section: libc math functions (3)
Return to Main Contents
gamma, gammaf, gammal - (logarithm of the) gamma function
double gamma(double x);
float gammaf(float x);
long double gammal(long double x);
Link with -lm.
For the definition of the Gamma function, see
4.4BSD and FreeBSD libm have a
function that computes the Gamma function, as one would expect.
Glibc has a
function that is equivalent to
and computes the natural logarithm of the Gamma function.
(This is for compatibility reasons only. Don't use this function.)
4.2BSD had a
leaving the sign of
in the external integer
In 4.3BSD the name was changed to
and the man page promises
"At some time in the future the name gamma will be rehabilitated
and used for the Gamma function"
This did indeed happen in 4.4BSD, where
computes the Gamma function (with no effect on
However, this came too late, and we now have
the "true gamma" function.
4.2BSD. Compatible with previous mistakes.
- *BSD version
- glibc version
- CONFORMING TO
- SEE ALSO
linux.jgfs.net manual pages