From cde43197f980538e411d851735ac7a63ddd613e1 Mon Sep 17 00:00:00 2001 From: Thomas Neidhart Date: Mon, 6 Oct 2014 22:50:20 +0200 Subject: [PATCH] Use MathUtils.PI_SQUARED. --- .../apache/commons/math3/distribution/GumbelDistribution.java | 3 ++- .../commons/math3/distribution/LogisticDistribution.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/math3/distribution/GumbelDistribution.java b/src/main/java/org/apache/commons/math3/distribution/GumbelDistribution.java index ae4d84296..f42a1e863 100644 --- a/src/main/java/org/apache/commons/math3/distribution/GumbelDistribution.java +++ b/src/main/java/org/apache/commons/math3/distribution/GumbelDistribution.java @@ -22,6 +22,7 @@ import org.apache.commons.math3.exception.util.LocalizedFormats; import org.apache.commons.math3.random.RandomGenerator; import org.apache.commons.math3.random.Well19937c; import org.apache.commons.math3.util.FastMath; +import org.apache.commons.math3.util.MathUtils; /** * This class implements the Gumbel distribution. @@ -127,7 +128,7 @@ public class GumbelDistribution extends AbstractRealDistribution { /** {@inheritDoc} */ public double getNumericalVariance() { - return (FastMath.PI * FastMath.PI) / 6.0 * (beta * beta); + return (MathUtils.PI_SQUARED) / 6.0 * (beta * beta); } /** {@inheritDoc} */ diff --git a/src/main/java/org/apache/commons/math3/distribution/LogisticDistribution.java b/src/main/java/org/apache/commons/math3/distribution/LogisticDistribution.java index 402b582f0..7305594eb 100644 --- a/src/main/java/org/apache/commons/math3/distribution/LogisticDistribution.java +++ b/src/main/java/org/apache/commons/math3/distribution/LogisticDistribution.java @@ -22,6 +22,7 @@ import org.apache.commons.math3.exception.util.LocalizedFormats; import org.apache.commons.math3.random.RandomGenerator; import org.apache.commons.math3.random.Well19937c; import org.apache.commons.math3.util.FastMath; +import org.apache.commons.math3.util.MathUtils; /** * This class implements the Logistic distribution. @@ -121,7 +122,7 @@ public class LogisticDistribution extends AbstractRealDistribution { /** {@inheritDoc} */ public double getNumericalVariance() { - return (FastMath.PI * FastMath.PI / 3.0) * (1.0 / (s * s)); + return (MathUtils.PI_SQUARED / 3.0) * (1.0 / (s * s)); } /** {@inheritDoc} */