You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2021/09/16 10:38:11 UTC
[commons-statistics] branch master updated: STATISTICS-3: Relaxed
tolerance is acceptable.
This is an automated email from the ASF dual-hosted git repository.
erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-statistics.git
The following commit(s) were added to refs/heads/master by this push:
new d16e1b4 STATISTICS-3: Relaxed tolerance is acceptable.
d16e1b4 is described below
commit d16e1b400dd2a0b8d86f16e204cb5a5f8c327894
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Thu Sep 16 12:35:43 2021 +0200
STATISTICS-3: Relaxed tolerance is acceptable.
---
.../org/apache/commons/statistics/distribution/GammaDistribution.java | 4 ++--
.../apache/commons/statistics/distribution/GammaDistributionTest.java | 4 ----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/GammaDistribution.java b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/GammaDistribution.java
index 58394ed..1a7b102 100644
--- a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/GammaDistribution.java
+++ b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/GammaDistribution.java
@@ -114,7 +114,7 @@ public class GammaDistribution extends AbstractContinuousDistribution {
this.logDensityPrefactor2 = Math.log(shape) + 0.5 * Math.log(aux) -
Math.log(LanczosApproximation.value(shape));
this.densityPrefactor1 = this.densityPrefactor2 / scale *
- Math.pow(shiftedShape, -shape) * // XXX FastMath vs Math
+ Math.pow(shiftedShape, -shape) *
Math.exp(shape + LANCZOS_G);
this.logDensityPrefactor1 = this.logDensityPrefactor2 - Math.log(scale) -
Math.log(shiftedShape) * shape +
@@ -193,7 +193,7 @@ public class GammaDistribution extends AbstractContinuousDistribution {
* Overflow.
*/
final double aux1 = (y - shiftedShape) / shiftedShape;
- final double aux2 = shape * (Math.log1p(aux1) - aux1); // XXX FastMath vs Math
+ final double aux2 = shape * (Math.log1p(aux1) - aux1);
final double aux3 = -y * (LANCZOS_G + 0.5) / shiftedShape + LANCZOS_G + aux2;
return densityPrefactor2 / x * Math.exp(aux3);
}
diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GammaDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GammaDistributionTest.java
index b1678d0..ad0451c 100644
--- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GammaDistributionTest.java
+++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GammaDistributionTest.java
@@ -390,8 +390,6 @@ class GammaDistributionTest extends ContinuousDistributionAbstractTest {
@Test
void testMath753Shape100() {
- // XXX Increased tolerance ("1.5" -> "2.0") to make test pass with JDK "Math"
- // where CM used "FastMath" (cf. "XXX" comment in main source code).
doTestMath753(100.0, 2.0, 1.0, 0.0, 0.0, "gamma-distribution-shape-100.csv");
}
@@ -402,8 +400,6 @@ class GammaDistributionTest extends ContinuousDistributionAbstractTest {
@Test
void testMath753Shape1000() {
- // XXX Increased tolerance ("220.0" -> "230.0") to make test pass with JDK "Math"
- // where CM used "FastMath" (cf. "XXX" comment in main source code).
doTestMath753(1000.0, 1.0, 1.0, 160.0, 230.0, "gamma-distribution-shape-1000.csv");
}
}