Added endpoint order check to cumulativeProbability(double, double).
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141248 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b31439f3ec
commit
dc8569711f
|
@ -24,7 +24,7 @@ import org.apache.commons.math.analysis.UnivariateRealSolverUtils;
|
|||
* implementations for some of the methods that do not vary from distribution
|
||||
* to distribution.
|
||||
*
|
||||
* @version $Revision: 1.21 $ $Date: 2004/05/19 14:16:31 $
|
||||
* @version $Revision: 1.22 $ $Date: 2004/05/30 01:24:02 $
|
||||
*/
|
||||
public abstract class AbstractContinuousDistribution
|
||||
implements ContinuousDistribution {
|
||||
|
@ -46,9 +46,14 @@ public abstract class AbstractContinuousDistribution
|
|||
* @return the cumulative probability.
|
||||
* @throws MathException if the cumulative probability can not be
|
||||
* computed due to convergence or other numerical errors.
|
||||
* @throws IllegalArgumentException if x0 > x1
|
||||
*/
|
||||
public double cumulativeProbability(double x0, double x1)
|
||||
throws MathException {
|
||||
if (x0 > x1) {
|
||||
throw new IllegalArgumentException
|
||||
("lower endpoint must be less than or equal to upper endpoint");
|
||||
}
|
||||
return cumulativeProbability(x1) - cumulativeProbability(x0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue