1GAMMA(3) libc math functions GAMMA(3)
2
3
4
6 gamma, gammaf, gammal - (logarithm of the) gamma function
7
9 #include <math.h>
10
11 double gamma(double x);
12 float gammaf(float x);
13 long double gammal(long double x);
14
15 Link with -lm.
16
18 For the definition of the Gamma function, see tgamma(3).
19
20 *BSD version
21 4.4BSD and FreeBSD libm have a gamma() function that computes the Gamma
22 function, as one would expect.
23
24 glibc version
25 Glibc has a gamma() function that is equivalent to lgamma() and com‐
26 putes the natural logarithm of the Gamma function. (This is for com‐
27 patibility reasons only. Don't use this function.)
28
30 4.2BSD had a gamma() that computed ln(|Gamma(|x|)|), leaving the sign
31 of Gamma(|x|) in the external integer signgam. In 4.3BSD the name was
32 changed to lgamma(), and the man page promises
33
34 "At some time in the future the name gamma will be rehabilitated and
35 used for the Gamma function"
36
37 This did indeed happen in 4.4BSD, where gamma() computes the Gamma
38 function (with no effect on signgam). However, this came too late, and
39 we now have tgamma(), the "true gamma" function.
40
42 4.2BSD. Compatible with previous mistakes.
43
45 lgamma(3), signgam(3), tgamma(3)
46
47
48
49GNU 2002-08-10 GAMMA(3)