Author: celestin
Date: Fri Aug 31 03:12:16 2012
New Revision: 1379270
URL: http://svn.apache.org/viewvc?rev=1379270&view=rev
Log:
MATH-849: changed boundary case x = 8.0 in double Gamma.logGamma(double).
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/special/Gamma.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/special/Gamma.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/special/Gamma.java?rev=1379270&r1=1379269&r2=1379270&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/special/Gamma.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/special/Gamma.java Fri
Aug 31 03:12:16 2012
@@ -222,9 +222,9 @@ public class Gamma {
* Returns the value of log Γ(x) for x > 0.
* </p>
* <p>
- * For x < 8, the implementation is based on the double precision
+ * For x ≤ 8, the implementation is based on the double precision
* implementation in the <em>NSWC Library of Mathematics Subroutines</em>,
- * {@code DGAMLN}. For x ≥ 8, the implementation is based on
+ * {@code DGAMLN}. For x > 8, the implementation is based on
* </p>
* <ul>
* <li><a href="http://mathworld.wolfram.com/GammaFunction.html">Gamma
@@ -249,7 +249,7 @@ public class Gamma {
return logGamma1p(x) - FastMath.log(x);
} else if (x <= 2.5) {
return logGamma1p((x - 0.5) - 0.5);
- } else if (x < 8.0) {
+ } else if (x <= 8.0) {
final int n = (int) FastMath.floor(x - 1.5);
double prod = 1.0;
for (int i = 1; i <= n; i++) {
|