1LGAMMA(3P) POSIX Programmer's Manual LGAMMA(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11 delim $$
12
14 lgamma, lgammaf, lgammal, signgam — log gamma function
15
17 #include <math.h>
18
19 double lgamma(double x);
20 float lgammaf(float x);
21 long double lgammal(long double x);
22 extern int signgam;
23
25 The functionality described on this reference page is aligned with the
26 ISO C standard. Any conflict between the requirements described here
27 and the ISO C standard is unintentional. This volume of POSIX.1‐2008
28 defers to the ISO C standard.
29
30 These functions shall compute $log_ e" " │ Γ ( ^ x ) │$ where $Γ ( ^ x
31 )$ is defined as $int from 0 to inf e"^" " "{ - t } t"^" " "{ x - 1 }
32 dt$. The argument x need not be a non-positive integer ($Γ( ^ x )$ is
33 defined over the reals, except the non-positive integers).
34
35 If x is NaN, −Inf, or a negative integer, the value of signgam is
36 unspecified.
37
38 These functions need not be thread-safe.
39
40 An application wishing to check for error situations should set errno
41 to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these
42 functions. On return, if errno is non-zero or fetestexcept(FE_INVALID |
43 FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has
44 occurred.
45
47 Upon successful completion, these functions shall return the logarith‐
48 mic gamma of x.
49
50 If x is a non-positive integer, a pole error shall occur and lgamma(),
51 lgammaf(), and lgammal() shall return +HUGE_VAL, +HUGE_VALF, and
52 +HUGE_VALL, respectively.
53
54 If the correct value would cause overflow, a range error shall occur
55 and lgamma(), lgammaf(), and lgammal() shall return ±HUGE_VAL,
56 ±HUGE_VALF, and ±HUGE_VALL (having the same sign as the correct value),
57 respectively.
58
59 If x is NaN, a NaN shall be returned.
60
61 If x is 1 or 2, +0 shall be returned.
62
63 If x is ±Inf, +Inf shall be returned.
64
66 These functions shall fail if:
67
68 Pole Error The x argument is a negative integer or zero.
69
70 If the integer expression (math_errhandling & MATH_ERRNO)
71 is non-zero, then errno shall be set to [ERANGE]. If the
72 integer expression (math_errhandling & MATH_ERREXCEPT) is
73 non-zero, then the divide-by-zero floating-point exception
74 shall be raised.
75
76 Range Error The result overflows.
77
78 If the integer expression (math_errhandling & MATH_ERRNO)
79 is non-zero, then errno shall be set to [ERANGE]. If the
80 integer expression (math_errhandling & MATH_ERREXCEPT) is
81 non-zero, then the overflow floating-point exception shall
82 be raised.
83
84 The following sections are informative.
85
87 None.
88
90 On error, the expressions (math_errhandling & MATH_ERRNO) and
91 (math_errhandling & MATH_ERREXCEPT) are independent of each other, but
92 at least one of them must be non-zero.
93
95 None.
96
98 None.
99
101 exp(), feclearexcept(), fetestexcept(), isnan()
102
103 The Base Definitions volume of POSIX.1‐2008, Section 4.19, Treatment of
104 Error Conditions for Mathematical Functions, <math.h>
105
107 Portions of this text are reprinted and reproduced in electronic form
108 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
109 -- Portable Operating System Interface (POSIX), The Open Group Base
110 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
111 cal and Electronics Engineers, Inc and The Open Group. (This is
112 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
113 event of any discrepancy between this version and the original IEEE and
114 The Open Group Standard, the original IEEE and The Open Group Standard
115 is the referee document. The original Standard can be obtained online
116 at http://www.unix.org/online.html .
117
118 Any typographical or formatting errors that appear in this page are
119 most likely to have been introduced during the conversion of the source
120 files to man page format. To report such errors, see https://www.ker‐
121 nel.org/doc/man-pages/reporting_bugs.html .
122
123
124
125IEEE/The Open Group 2013 LGAMMA(3P)