Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:12

0001 #include "CommonTools/Statistics/src/GammaLn.h"
0002 #include <cmath>
0003 
0004 float GammaLn(float z) {
0005   const static double coefficients[6] = {76.18009172947146,
0006                                          -86.50532032941677,
0007                                          24.01409824083091,
0008                                          -1.231739572450155,
0009                                          0.1208650973866179e-2,
0010                                          -0.5395239384953e-5};
0011 
0012   double temp = z + 5.5;
0013   temp -= (z + 0.5) * log(temp);
0014   double y = z;
0015   double series = 1.000000000190015;
0016   for (int term = 0; term < 6; term++)
0017     series += coefficients[term] / ++y;
0018   return -temp + log(2.5066282746310005 * series / z);
0019 }