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