|
ocssw
1.0
|
00001 #include <math.h> 00002 00003 float gammln(float xx) 00004 { 00005 double x,y,tmp,ser; 00006 static double cof[6]={76.18009172947146,-86.50532032941677, 00007 24.01409824083091,-1.231739572450155, 00008 0.1208650973866179e-2,-0.5395239384953e-5}; 00009 int j; 00010 00011 y=x=xx; 00012 tmp=x+5.5; 00013 tmp -= (x+0.5)*log(tmp); 00014 ser=1.000000000190015; 00015 for (j=0;j<=5;j++) ser += cof[j]/++y; 00016 return -tmp+log(2.5066282746310005*ser/x); 00017 }
1.7.6.1