commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From turicum <turi...@gmail.com>
Subject DescriptiveStatistics: addValue throws exception after clear
Date Mon, 20 Jul 2009 21:14:40 GMT

Hi everybody!

The following code throws an exception if x > 160

package test;
import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
public class Test {
	public static void main(String[] strings) {
		int x = 161; // 160 works
		DescriptiveStatistics descriptiveStatistics = new
DescriptiveStatistics(100);
		for (int i = 0; i < x; i++) descriptiveStatistics.addValue(1.2);
		descriptiveStatistics.clear();
		descriptiveStatistics.addValue(1.2);
	}
}


Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 32
	at
org.apache.commons.math.util.ResizableDoubleArray.addElement(ResizableDoubleArray.java:255)
	at
org.apache.commons.math.stat.descriptive.DescriptiveStatistics.addValue(DescriptiveStatistics.java:168)
	at test.Test.main(Test.java:11)

Am I missing anything?
Thanks!
Alex

-- 
View this message in context: http://www.nabble.com/DescriptiveStatistics%3A-addValue-throws-exception-after-clear-tp24577692p24577692.html
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message