question: public static double gamma ( double z ) { if ( z < 2.0 ) { return ( Internalgamma ( z ) ) ; } else { double multiplier = Math . floor ( z / 1.2 ) ; double remainder = z / multiplier ; double coef1 = Math . pow ( 2.0 * Math . PI , ( 0.5 * ( 1.0 - multiplier ) ) ) ; double coef2 = Math . pow ( multiplier , ( ( multiplier * remainder ) - 0.5 ) ) ; int N = ( int ) multiplier ; double prod = 1.0 ; for ( int k = 0 ; k < N ; k ++ ) { prod *= Internalgamma ( remainder + ( ( double ) k / multiplier ) ) ; } return coef1 * coef2 * prod ; } }
target:  GAMMA FUNCTION  (From DStat, used by permission). <p> Calculates the value of gamma(double z) using Handbook of Mathematical Functions AMS 55 by Abromowitz page 256.