1GAMMA(3) Linux Programmer's Manual 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
17 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19 gamma(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE
20 gammaf(), gammal(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600
21
23 These functions are deprecated: instead, use either the tgamma(3) or
24 the lgamma(3) functions, as appropriate.
25
26 For the definition of the Gamma function, see tgamma(3).
27
28 *BSD version
29 The libm in 4.4BSD and some versions of FreeBSD had a gamma() function
30 that computes the Gamma function, as one would expect.
31
32 glibc version
33 Glibc has a gamma() function that is equivalent to lgamma(3) and com‐
34 putes the natural logarithm of the Gamma function.
35
37 See lgamma(3).
38
40 See lgamma(3).
41
43 Because of historical variations in behavior across systems, this func‐
44 tion is not specified in any standard.
45
47 History
48 4.2BSD had a gamma() that computed ln(|Gamma(|x|)|), leaving the sign
49 of Gamma(|x|) in the external integer signgam. In 4.3BSD the name was
50 changed to lgamma(3), and the man page promises
51
52 "At some time in the future the name gamma will be rehabilitated
53 and used for the Gamma function"
54
55 This did indeed happen in 4.4BSD, where gamma() computes the Gamma
56 function (with no effect on signgam). However, this came too late, and
57 we now have tgamma(3), the "true gamma" function.
58
60 lgamma(3), signgam(3), tgamma(3)
61
63 This page is part of release 3.22 of the Linux man-pages project. A
64 description of the project, and information about reporting bugs, can
65 be found at http://www.kernel.org/doc/man-pages/.
66
67
68
69GNU 2008-08-05 GAMMA(3)