C program for floating point log gamma function
gamma(x) computes the log of the absolute
value of the gamma function.
The sign of the gamma function is returned in the
external quantity signgam.
The coefficients for expansion around zero
are #5243 from Hart & Cheney; for expansion
around infinity they are #5404.
static double goobie
= 0.9189385332046727417803297;
static double pi
= 3.1415926535897932384626434;
0.83333333333333101837e-1,
-.42353689509744089647e5
,
-.20886861789269887364e5
,
-.87627102978521489560e4
,
-.20085274013072791214e4
,
-.43933044406002567613e3
,
-.50108693752970953015e2
,
-.67449507245925289918e1
,
-.42353689509744090010e5
,
-.29803853309256649932e4
,
0.99403074150827709015e4
,
-.15286072737795220248e4
,
-.49902852662143904834e3
,
0.18949823415702801641e3
,
-.23081551524580124562e2
,
0.10000000000000000000e1
,
double log(), pos(), neg(), asym();
if(arg
<= 0.) return(neg(arg
));
if(arg
> 8.) return(asym(arg
));
for(n
=0,i
=M
-1; i
>=0; i
--){
return((arg
-.5)*log(arg
) - arg
+ goobie
+ n
/arg
);
double log(), sin(), pos();
if(temp
< 0.) temp
= -temp
;
return(-log(arg
*pos(arg
)*temp
/pi
));
if(arg
< 2.) return(pos(arg
+1.)/arg
);
if(arg
> 3.) return((arg
-1.)*pos(arg
-1.));
for(n
=0,d
=0,i
=N
-1; i
>=0; i
--){