1LGAMMA(P)                  POSIX Programmer's Manual                 LGAMMA(P)
2
3
4

NAME

6       lgamma, lgammaf, lgammal - log gamma function
7

SYNOPSIS

9       #include <math.h>
10
11       double lgamma(double x);
12       float lgammaf(float x);
13       long double lgammal(long double x);
14
15
16       extern int signgam;
17
18

DESCRIPTION

20       These functions shall compute
21
22
23       The  argument x need not be a non-positive integer (Gamma(x) is defined
24       over the reals, except the non-positive integers).
25
26       The sign of Gamma(x) is returned in the external integer signgam.
27
28       These functions need not be reentrant. A function that is not  required
29       to be reentrant is not required to be thread-safe.
30
31       An  application  wishing to check for error situations should set errno
32       to zero and  call  feclearexcept(FE_ALL_EXCEPT)  before  calling  these
33       functions.   On return, if errno is non-zero or fetestexcept(FE_INVALID
34       | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error  has
35       occurred.
36

RETURN VALUE

38       Upon  successful completion, these functions shall return the logarith‐
39       mic gamma of x.
40
41       If x is a non-positive integer, a pole error shall occur and  lgamma(),
42       lgammaf(),  and  lgammal()  shall  return  +HUGE_VAL,  +HUGE_VALF,  and
43       +HUGE_VALL, respectively.
44
45       If the correct value would cause overflow, a range  error  shall  occur
46       and   lgamma(),   lgammaf(),  and  lgammal()  shall  return  ±HUGE_VAL,
47       ±HUGE_VALF, and ±HUGE_VALL (having the same sign as the correct value),
48       respectively.
49
50       If x is NaN, a NaN shall be returned.
51
52       If x is 1 or 2, +0 shall be returned.
53
54       If x is ±Inf, +Inf shall be returned.
55

ERRORS

57       These functions shall fail if:
58
59       Pole Error
60              The x argument is a negative integer or zero.
61
62       If  the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
63       then errno  shall  be  set  to  [ERANGE].  If  the  integer  expression
64       (math_errhandling  &  MATH_ERREXCEPT)  is non-zero, then the divide-by-
65       zero floating-point exception shall be raised.
66
67       Range Error
68              The result overflows.
69
70       If the integer expression (math_errhandling & MATH_ERRNO) is  non-zero,
71       then  errno  shall  be  set  to  [ERANGE].  If  the  integer expression
72       (math_errhandling & MATH_ERREXCEPT)  is  non-zero,  then  the  overflow
73       floating-point exception shall be raised.
74
75
76       The following sections are informative.
77

EXAMPLES

79       None.
80

APPLICATION USAGE

82       On   error,   the   expressions  (math_errhandling  &  MATH_ERRNO)  and
83       (math_errhandling & MATH_ERREXCEPT) are independent of each other,  but
84       at least one of them must be non-zero.
85

RATIONALE

87       None.
88

FUTURE DIRECTIONS

90       None.
91

SEE ALSO

93       exp()  ,  feclearexcept() , fetestexcept() , isnan() , the Base Defini‐
94       tions volume of IEEE Std 1003.1-2001, Section 4.18, Treatment of  Error
95       Conditions for Mathematical Functions, <math.h>
96
98       Portions  of  this text are reprinted and reproduced in electronic form
99       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
100       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
101       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
102       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
103       event of any discrepancy between this version and the original IEEE and
104       The  Open Group Standard, the original IEEE and The Open Group Standard
105       is the referee document. The original Standard can be  obtained  online
106       at http://www.opengroup.org/unix/online.html .
107
108
109
110IEEE/The Open Group                  2003                            LGAMMA(P)
Impressum