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():
20 _XOPEN_SOURCE
21 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
22 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
23 gammaf(), gammal():
24 _XOPEN_SOURCE >= 600 || (_XOPEN_SOURCE && _ISOC99_SOURCE)
25 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
26 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
27
29 These functions are deprecated: instead, use either the tgamma(3) or
30 the lgamma(3) functions, as appropriate.
31
32 For the definition of the Gamma function, see tgamma(3).
33
34 *BSD version
35 The libm in 4.4BSD and some versions of FreeBSD had a gamma() function
36 that computes the Gamma function, as one would expect.
37
38 glibc version
39 Glibc has a gamma() function that is equivalent to lgamma(3) and com‐
40 putes the natural logarithm of the Gamma function.
41
43 See lgamma(3).
44
46 See lgamma(3).
47
49 For an explanation of the terms used in this section, see
50 attributes(7).
51
52 ┌────────────────────────────┬───────────────┬────────────────────────┐
53 │Interface │ Attribute │ Value │
54 ├────────────────────────────┼───────────────┼────────────────────────┤
55 │gamma(), gammaf(), gammal() │ Thread safety │ MT-Unsafe race:signgam │
56 └────────────────────────────┴───────────────┴────────────────────────┘
58 Because of historical variations in behavior across systems, this func‐
59 tion is not specified in any recent standard. It was documented in
60 SVID 2.
61
63 History
64 4.2BSD had a gamma() that computed ln(|Gamma(|x|)|), leaving the sign
65 of Gamma(|x|) in the external integer signgam. In 4.3BSD the name was
66 changed to lgamma(3), and the man page promises
67
68 "At some time in the future the name gamma will be rehabilitated
69 and used for the Gamma function"
70
71 This did indeed happen in 4.4BSD, where gamma() computes the Gamma
72 function (with no effect on signgam). However, this came too late, and
73 we now have tgamma(3), the "true gamma" function.
74
76 lgamma(3), signgam(3), tgamma(3)
77
79 This page is part of release 5.02 of the Linux man-pages project. A
80 description of the project, information about reporting bugs, and the
81 latest version of this page, can be found at
82 https://www.kernel.org/doc/man-pages/.
83
84
85
86GNU 2017-09-15 GAMMA(3)