1LGAMMA(3)                  Linux Programmer's Manual                 LGAMMA(3)
2
3
4

NAME

6       lgamma, lgammaf, lgammal, lgamma_r, lgammaf_r, lgammal_r, signgam - log
7       gamma function
8

SYNOPSIS

10       #include <math.h>
11
12       double lgamma(double x);
13       float lgammaf(float x);
14       long double lgammal(long double x);
15
16       double lgamma_r(double x, int *signp);
17       float lgammaf_r(float x, int *signp);
18       long double lgammal_r(long double x, int *signp);
19
20       extern int signgam;
21
22       Link with -lm.
23
24   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
25
26       lgamma(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE ||
27       _ISOC99_SOURCE; or cc -std=c99
28       lgammaf(), lgammal(): _BSD_SOURCE || _SVID_SOURCE ||
29       _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or cc -std=c99
30       lgamma_r(), lgammaf_r(), lgammal_r(): _BSD_SOURCE || _SVID_SOURCE
31       signgam: _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE
32

DESCRIPTION

34       For the definition of the Gamma function, see tgamma(3).
35
36       The lgamma() function returns the natural  logarithm  of  the  absolute
37       value  of  the  Gamma  function.   The  sign  of  the Gamma function is
38       returned in the external integer signgam declared in <math.h>.  It is 1
39       when the Gamma function is positive or zero, -1 when it is negative.
40
41       Since  using  a constant location signgam is not thread-safe, the func‐
42       tions lgamma_r() etc. have been introduced; they return  the  sign  via
43       the argument signp.
44

RETURN VALUE

46       On success, these functions return the natural logarithm of Gamma(x).
47
48       If x is a NaN, a NaN is returned.
49
50       If x is 1 or 2, +0 is returned.
51
52       If  x  is  positive infinity or negative infinity, positive infinity is
53       returned.
54
55       If x is a non-positive integer, a pole error occurs, and the  functions
56       return +HUGE_VAL, +HUGE_VALF, or +HUGE_VALL, respectively.
57
58       If the result overflows, a range error occurs, and the functions return
59       HUGE_VAL, HUGE_VALF, or HUGE_VALL, respectively, with the correct math‐
60       ematical sign.
61

ERRORS

63       See  math_error(7) for information on how to determine whether an error
64       has occurred when calling these functions.
65
66       The following errors can occur:
67
68       Pole error: x is a non-positive integer
69              errno is set to ERANGE (but see BUGS).  A divide-by-zero  float‐
70              ing-point exception (FE_DIVBYZERO) is raised.
71
72       Range error: result overflow
73              errno  is  set  to ERANGE.  An overflow floating-point exception
74              (FE_OVERFLOW) is raised.
75

CONFORMING TO

77       The lgamma() functions are specified in C99 and POSIX.1-2001.   signgam
78       is specified in POSIX.1-2001, but not in C99.  The lgamma_r() functions
79       are non-standard, but present on several other systems.
80

BUGS

82       For a pole error, errno is set to EDOM; POSIX.1 says it should  be  set
83       to ERANGE.
84

SEE ALSO

86       tgamma(3)
87

COLOPHON

89       This  page  is  part of release 3.22 of the Linux man-pages project.  A
90       description of the project, and information about reporting  bugs,  can
91       be found at http://www.kernel.org/doc/man-pages/.
92
93
94
95                                  2008-08-05                         LGAMMA(3)
Impressum