BSD 4_4 development
[unix-history] / usr / share / man / cat3 / lgamma.0
LGAMMA(3) BSD Programmer's Manual LGAMMA(3)
N\bNA\bAM\bME\bE
l\blg\bga\bam\bmm\bma\ba g\bga\bam\bmm\bma\ba - log gamma function, gamma function
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
#\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bma\bat\bth\bh.\b.h\bh>\b>
_\be_\bx_\bt_\be_\br_\bn _\bi_\bn_\bt _\bs_\bi_\bg_\bn_\bg_\ba_\bm;
_\bd_\bo_\bu_\bb_\bl_\be
l\blg\bga\bam\bmm\bma\ba(_\bd_\bo_\bu_\bb_\bl_\be _\bx);
_\bd_\bo_\bu_\bb_\bl_\be
g\bga\bam\bmm\bma\ba(_\bd_\bo_\bu_\bb_\bl_\be _\bx);
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN _
L\bLg\bga\bam\bmm\bma\ba(_\bx) returns ln|| (x)|.
_
The external integer _\bs_\bi_\bg_\bn_\bg_\ba_\bm returns the sign of | (x).
_
G\bGa\bam\bmm\bma\ba(_\bx) returns | (x), with no effect on _\bs_\bi_\bg_\bn_\bg_\ba_\bm.
I\bID\bDI\bIO\bOS\bSY\bYN\bNC\bCR\bRA\bAS\bSI\bIE\bES\bS
Do\b_ 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 l\blg\bga\bam\bmm\bma\ba() has returned can signgam be correct.
For arguments in its range, g\bga\bam\bmm\bma\ba() is preferred, as for positive argu-
ments it is accurate to within one unit in the last place. Exponentia-
tion of l\blg\bga\bam\bmm\bma\ba() will lose up to 10 significant bits.
R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
G\bGa\bam\bmm\bma\ba() and l\blg\bga\bam\bmm\bma\ba() 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 _\be_\br_\br_\bn_\bo is set to ERANGE For large non-integer negative values,
g\bga\bam\bmm\bma\ba() will underflow.
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
math(3), infnan(3)
H\bHI\bIS\bST\bTO\bOR\bRY\bY
The l\blg\bga\bam\bmm\bma\ba function appeared in 4.3BSD. The g\bga\bam\bmm\bma\ba function appeared in
4.4BSD. The name g\bga\bam\bmm\bma\ba() was originally dedicated to the l\blg\bga\bam\bmm\bma\ba() func-
tion, so some old code may no longer be compatible.
4.3 Berkeley Distribution June 4, 1993 1