commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <>
Subject [MATH] Test failure in Continuum
Date Sat, 04 Aug 2012 17:57:12 GMT

Referring to this failed test (cf. messages from Continuum):
org.apache.commons.math3.exception.NumberIsTooLargeException: lower bound (65) must be strictly
less than upper bound (65)
	at org.apache.commons.math3.distribution.UniformIntegerDistribution.<init>(
	at org.apache.commons.math3.distribution.UniformIntegerDistribution.<init>(
	at org.apache.commons.math3.stat.descriptive.AggregateSummaryStatisticsTest.generatePartition(
	at org.apache.commons.math3.stat.descriptive.AggregateSummaryStatisticsTest.testAggregationConsistency(

It is due to a precondition check while creating the
"UniformIntegerDistribution" instance:
if (lower >= upper) {
    throw new NumberIsTooLargeException(
                       lower, upper, false);

The test referred to above was using this code (before I changed it use a
"UniformIntegerDistribution" instance):
final int next = (i == 4 || cur == length - 1) ? length - 1 : randomData.nextInt(cur, length
- 1);

It is now (after the change):
final IntegerDistribution partitionPoint = new UniformIntegerDistribution(cur, length - 1);
final int next = (i == 4 || cur == length - 1) ? length - 1 : partitionPoint.sample();

Thus, AFAIK, the failure did not appear before because there was no
precondition enforcement in "nextInt".

The question is: Was the code in the test correct (in allowing the same
value for both bounds?
 * In the negative, how to change it?
 * The affirmative would mean that the precondition check in
   "UniformIntegerDistribution" should be relaxed to allow equal bounds.
   Does this make sense?
   If so, can we change it now, or is it forbidden in order to stay
   backwards compatible?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message