Debian Codegraph @

upstream/debian-unstable/man3/gamma.3

raw
1 '\" t
2 .\" Copyright 2002, Walter Harms <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: GPL-1.0-or-later
6 .\"
7 .TH gamma 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 gamma, gammaf, gammal \- (logarithm of the) gamma function
10 .SH LIBRARY
11 Math library
12 .RI ( libm ,\~ \-lm )
13 .SH SYNOPSIS
14 .nf
15 .B #include <math.h>
16 .P
17 .BI "[[deprecated]] double gamma(double " x ");"
18 .BI "[[deprecated]] float gammaf(float " x ");"
19 .BI "[[deprecated]] long double gammal(long double " x ");"
20 .fi
21 .P
22 .RS -4
23 Feature Test Macro Requirements for glibc (see
24 .BR feature_test_macros (7)):
25 .RE
26 .P
27 .BR gamma ():
28 .nf
29 _XOPEN_SOURCE
30 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
31 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
32 .fi
33 .P
34 .BR gammaf (),
35 .BR gammal ():
36 .nf
37 _XOPEN_SOURCE >= 600 || (_XOPEN_SOURCE && _ISOC99_SOURCE)
38 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
39 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
40 .fi
41 .SH DESCRIPTION
42 These functions are deprecated: instead, use either the
43 .BR tgamma (3)
44 or the
45 .BR lgamma (3)
46 functions, as appropriate.
47 .P
48 For the definition of the Gamma function, see
49 .BR tgamma (3).
50 .SS *BSD version
51 The libm in 4.4BSD and some versions of FreeBSD had a
52 .BR gamma ()
53 function that computes the Gamma function, as one would expect.
54 .SS glibc version
55 glibc has a
56 .BR gamma ()
57 function that is equivalent to
58 .BR lgamma (3)
59 and computes the natural logarithm of the Gamma function.
60 .SH RETURN VALUE
61 See
62 .BR lgamma (3).
63 .SH ERRORS
64 See
65 .BR lgamma (3).
66 .SH ATTRIBUTES
67 For an explanation of the terms used in this section, see
68 .BR attributes (7).
69 .TS
70 allbox;
71 lbx lb lb
72 l l l.
73 Interface Attribute Value
74 T{
75 .na
76 .nh
77 .BR gamma (),
78 .BR gammaf (),
79 .BR gammal ()
80 T} Thread safety MT-Unsafe race:signgam
81 .TE
82 .SH STANDARDS
83 None.
84 .SH HISTORY
85 SVID 2.
86 .P
87 Because of historical variations in behavior across systems,
88 this function is not specified in any recent standard.
89 .P
90 4.2BSD had a
91 .BR gamma ()
92 that computed
93 .RI ln(|Gamma(| x |)|),
94 leaving the sign of
95 .RI Gamma(| x |)
96 in the external integer
97 .IR signgam .
98 In 4.3BSD the name was changed to
99 .BR lgamma (3),
100 and the man page promises
101 .P
102 .in +4n
103 "At some time in the future the name gamma will be rehabilitated
104 and used for the Gamma function"
105 .in
106 .P
107 This did indeed happen in 4.4BSD, where
108 .BR gamma ()
109 computes the Gamma function (with no effect on
110 .IR signgam ).
111 However, this came too late, and we now have
112 .BR tgamma (3),
113 the "true gamma" function.
114 .\" The FreeBSD man page says about gamma() that it is like lgamma()
115 .\" except that is does not set signgam.
116 .\" Also, that 4.4BSD has a gamma() that computes the true gamma function.
117 .SH SEE ALSO
118 .BR lgamma (3),
119 .BR signgam (3),
120 .BR tgamma (3)