From 1ef23c85f7688088679b33cc7f261bf0a7ed8d31 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 7 Mar 2017 13:17:33 +0100 Subject: [PATCH] fixed files form Math #60 --- .../math/distribution/NormalDistributionImpl.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/projects/Math/60/org/apache/commons/math/distribution/NormalDistributionImpl.java b/projects/Math/60/org/apache/commons/math/distribution/NormalDistributionImpl.java index 0e124d8..0d7ce7d 100644 --- a/projects/Math/60/org/apache/commons/math/distribution/NormalDistributionImpl.java +++ b/projects/Math/60/org/apache/commons/math/distribution/NormalDistributionImpl.java @@ -123,18 +123,11 @@ public double density(double x) { */ public double cumulativeProbability(double x) throws MathException { final double dev = x - mean; - try { + if (FastMath.abs(dev) > 40 * standardDeviation) { + return dev < 0 ? 0.0d : 1.0d; + } return 0.5 * (1.0 + Erf.erf((dev) / (standardDeviation * FastMath.sqrt(2.0)))); - } catch (MaxIterationsExceededException ex) { - if (x < (mean - 20 * standardDeviation)) { // JDK 1.5 blows at 38 - return 0; - } else if (x > (mean + 20 * standardDeviation)) { - return 1; - } else { - throw ex; - } - } } /**