question: public static double logGamma ( double xx ) { double x = xx - 1.0 ; double tmp = x + 5.5 ; tmp -= ( x + 0.5 ) * Math . log ( tmp ) ; double ser = 1.000000000190015 ; double [ ] coeff = cof ; for ( int j = 0 ; j <= 5 ; j ++ ) { x ++ ; ser += coeff [ j ] / x ; } return - tmp + Math . log ( 2.5066282746310005 * ser ) ; }
target:  Returns the value ln(Gamma(xx) for xx > 0.  Full accuracy is obtained for  xx > 1. For 0 < xx < 1. the reflection formula (6.1.4) can be used first. (Adapted from Numerical Recipes in C)