4.4BSD/usr/share/man/cat3/lgamma.0
LGAMMA(3) BSD Programmer's Manual LGAMMA(3)
NNAAMMEE
llggaammmmaa ggaammmmaa - log gamma function, gamma function
SSYYNNOOPPSSIISS
##iinncclluuddee <<mmaatthh..hh>>
_e_x_t_e_r_n _i_n_t _s_i_g_n_g_a_m;
_d_o_u_b_l_e
llggaammmmaa(_d_o_u_b_l_e _x);
_d_o_u_b_l_e
ggaammmmaa(_d_o_u_b_l_e _x);
DDEESSCCRRIIPPTTIIOONN _
LLggaammmmaa(_x) returns ln|| (x)|.
_
The external integer _s_i_g_n_g_a_m returns the sign of | (x).
_
GGaammmmaa(_x) returns | (x), with no effect on _s_i_g_n_g_a_m.
IIDDIIOOSSYYNNCCRRAASSIIEESS
Do_ not use the expression ``signgam*exp(lgamma(x))'' to compute g :=
| (x). Instead use a program like this (in C):
lg = lgamma(x); g = signgam*exp(lg);
Only after llggaammmmaa() has returned can signgam be correct.
For arguments in its range, ggaammmmaa() is preferred, as for positive argu-
ments it is accurate to within one unit in the last place. Exponentia-
tion of llggaammmmaa() will lose up to 10 significant bits.
RREETTUURRNN VVAALLUUEESS
GGaammmmaa() and llggaammmmaa() return appropriate values unless an arguent is out
of range. Overflow will occur for sufficiently large positive values,
and non-positive integers. On the VAX, the reserved operator is re-
turned, and _e_r_r_n_o is set to ERANGE For large non-integer negative values,
ggaammmmaa() will underflow.
SSEEEE AALLSSOO
math(3), infnan(3)
HHIISSTTOORRYY
The llggaammmmaa function appeared in 4.3BSD. The ggaammmmaa function appeared in
4.4BSD. The name ggaammmmaa() was originally dedicated to the llggaammmmaa() func-
tion, so some old code may no longer be compatible.
4.3 Berkeley Distribution June 4, 1993 1