1gamma(3) Library Functions Manual gamma(3)
2
3
4
6 gamma, gammaf, gammal - (logarithm of the) gamma function
7
9 Math library (libm, -lm)
10
12 #include <math.h>
13
14 [[deprecated]] double gamma(double x);
15 [[deprecated]] float gammaf(float x);
16 [[deprecated]] long double gammal(long double x);
17
18 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
19
20 gamma():
21 _XOPEN_SOURCE
22 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
23 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
24
25 gammaf(), gammal():
26 _XOPEN_SOURCE >= 600 || (_XOPEN_SOURCE && _ISOC99_SOURCE)
27 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
28 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
29
31 These functions are deprecated: instead, use either the tgamma(3) or
32 the lgamma(3) functions, as appropriate.
33
34 For the definition of the Gamma function, see tgamma(3).
35
36 *BSD version
37 The libm in 4.4BSD and some versions of FreeBSD had a gamma() function
38 that computes the Gamma function, as one would expect.
39
40 glibc version
41 glibc has a gamma() function that is equivalent to lgamma(3) and com‐
42 putes the natural logarithm of the Gamma function.
43
45 See lgamma(3).
46
48 See lgamma(3).
49
51 For an explanation of the terms used in this section, see at‐
52 tributes(7).
53
54 ┌─────────────────────────────┬───────────────┬────────────────────────┐
55 │Interface │ Attribute │ Value │
56 ├─────────────────────────────┼───────────────┼────────────────────────┤
57 │gamma(), gammaf(), gammal() │ Thread safety │ MT-Unsafe race:signgam │
58 └─────────────────────────────┴───────────────┴────────────────────────┘
59
61 None.
62
64 SVID 2.
65
66 Because of historical variations in behavior across systems, this
67 function is not specified in any recent standard.
68
69 4.2BSD had a gamma() that computed ln(|Gamma(|x|)|), leaving the sign
70 of Gamma(|x|) in the external integer signgam. In 4.3BSD the name was
71 changed to lgamma(3), and the man page promises
72
73 "At some time in the future the name gamma will be rehabilitated
74 and used for the Gamma function"
75
76 This did indeed happen in 4.4BSD, where gamma() computes the Gamma
77 function (with no effect on signgam). However, this came too late, and
78 we now have tgamma(3), the "true gamma" function.
79
81 lgamma(3), signgam(3), tgamma(3)
82
83
84
85Linux man-pages 6.05 2023-07-20 gamma(3)