Skip to content

Commit

Permalink
fixed files form Math #60
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 6d573ea commit 1ef23c8
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

/**
Expand Down

0 comments on commit 1ef23c8

Please sign in to comment.