5 C program for floating point log gamma function
7 gamma(x) computes the log of the absolute
8 value of the gamma function.
9 The sign of the gamma function is returned in the
10 external quantity signgam.
12 The coefficients for expansion around zero
13 are #5243 from Hart & Cheney; for expansion
14 around infinity they are #5404.
20 static double goobie = 0.9189385332046727417803297;
21 static double pi = 3.1415926535897932384626434;
25 static double p1[] = {
26 0.83333333333333101837e-1,
27 -.277777777735865004e-2,
33 static double p2[] = {
34 -.42353689509744089647e5,
35 -.20886861789269887364e5,
36 -.87627102978521489560e4,
37 -.20085274013072791214e4,
38 -.43933044406002567613e3,
39 -.50108693752970953015e2,
40 -.67449507245925289918e1,
43 static double q2[] = {
44 -.42353689509744090010e5,
45 -.29803853309256649932e4,
46 0.99403074150827709015e4,
47 -.15286072737795220248e4,
48 -.49902852662143904834e3,
49 0.18949823415702801641e3,
50 -.23081551524580124562e2,
51 0.10000000000000000000e1,
60 argsq = 1 / (arg*arg);
64 return (arg-.5)*log(arg) - arg + goobie + n/arg;
74 return pos(arg+1)/arg;
76 return (arg-1)*pos(arg-1);
81 for(i=N-1; i>=0; i--){
103 return -log(arg*pos(arg)*temp/pi);
115 return log(pos(arg));