In Gamma.logGamma, replaced local variable g with class variable LANCZOS_G.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1376835 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastien Brisard 2012-08-24 06:23:34 +00:00
parent 7b1b5e529c
commit e9b6a4ffb3

View File

@ -95,9 +95,8 @@ public class Gamma {
if (Double.isNaN(x) || (x <= 0.0)) { if (Double.isNaN(x) || (x <= 0.0)) {
ret = Double.NaN; ret = Double.NaN;
} else { } else {
double g = 607.0 / 128.0;
double sum = lanczos(x); double sum = lanczos(x);
double tmp = x + g + .5; double tmp = x + LANCZOS_G + .5;
ret = ((x + .5) * FastMath.log(tmp)) - tmp + ret = ((x + .5) * FastMath.log(tmp)) - tmp +
HALF_LOG_2_PI + FastMath.log(sum / x); HALF_LOG_2_PI + FastMath.log(sum / x);
} }