svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
lgamma(3m)
Mathematical Library Functions lgamma(3M)
NAME
lgamma, lgammaf, lgammal, lgamma_r, lgammaf_r, lgammal_r, gamma, gam‐
maf, gammal, gamma_r, gammaf_r, gammal_r - log gamma function
SYNOPSIS
c99 [ flag... ] file... -lm [ library... ]
#include <math.h>
extern int signgam;
double lgamma(double x);
float lgammaf(float x);
long double lgammal(long double x);
double gamma(double x);
float gammaf(float x);
long double gammal(long double x);
double lgamma_r(double x, int *signgamp);
float lgammaf_r(float x, int *signgamp);
long double lgammal_r(long double x, int *signgamp);
double gamma_r(double x, int *signgamp);
float gammaf_r(float x, int *signgamp);
long double gammal_r(long double x, int *signgamp);
DESCRIPTION
These functions return
ln||~(x)|.sp
where
|~(x) = integral from 0 to +Infinity of pow(t,x-1)*exp(-t) dt.sp
for x > 0 and
|~(x) = n/(|~(1-x)sin(nx)).sp
for x < 1.
These functions use the external integer signgam to return the sign of
|~(x) while lgamma_r() and gamma_r() use the user-allocated space
addressed by signgamp.
RETURN VALUES
Upon successful completion, these functions return the logarithmic
gamma of x.
If x is a non-positive integer, a pole error occurs and these functions
return +HUGE_VAL, +HUGE_VALF, and +HUGE_VALL, respectively.
If x is NaN, a NaN is returned.
If x is 1 or 2, +0 shall be returned.
If x is ±Inf, +Inf is returned.
ERRORS
These functions will fail if:
Pole Error The x argument is a negative integer or 0.
If the integer expression (math_errhandling & MATH_ERREX‐
CEPT) is non-zero, then the divide-by-zero floating-point
exception is raised.
USAGE
An application wanting to check for exceptions should call feclearex‐
cept(FE_ALL_EXCEPT) before calling these functions. On return, if
fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
non-zero, an exception has been raised. An application should either
examine the return value or check the floating point exception flags to
detect exceptions.
In the case of lgamma(), do not use the expression
signgam*exp(lgamma(x)) to compute
`g := |~(x)'.sp
Instead compute lgamma() first:
lg = lgamma(x); g = signgam*exp(lg);
only after lgamma() has returned can signgam be correct. Note that
|~(x) must overflow when x is large enough, underflow when −x is large
enough, and generate a division by 0 exception at the singularities x a
nonpositive integer.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i)
ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted _ Avail‐
abilitysystem/library/math _ MT-LevelSee below. _ StandardSee below.
The lgamma(), lgammaf(), lgammal(), gamma(), gammaf(), and gammal()
functions are Unsafe in multithreaded applications. The lgamma_r(),
lgammaf_r(), lgammal_r(), gamma_r(), gammaf_r(), and gammal_r() func‐
tions are MT-Safe and should be used instead.
For lgamma(), lgammaf(), lgammal(), and gamma(), see standards(7).
SEE ALSO
math.h(3HEAD), exp(3M), feclearexcept(3M), fetestexcept(3M), isnan(3M),
attributes(7), standards(7)
Solaris 11.4 27 Sept 2016 lgamma(3M)