CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CommonTools/Statistics/src/GammaLn.cc

Go to the documentation of this file.
00001 #include "CommonTools/Statistics/src/GammaLn.h"
00002 #include <cmath>
00003 
00004 float
00005 GammaLn( float z )
00006 {
00007   const static double coefficients[6] = 
00008   { 76.18009172947146, -86.50532032941677,      24.01409824083091,
00009     -1.231739572450155,  0.1208650973866179e-2, -0.5395239384953e-5 };
00010 
00011   double temp = z+5.5;
00012   temp -= (z+0.5)*log(temp);
00013   double y = z;
00014   double series = 1.000000000190015;
00015   for( int term = 0; term < 6; term++ )
00016     series += coefficients[term]/++y;
00017   return -temp + log(2.5066282746310005*series/z);
00018 }