[
https://issues.apache.org/jira/browse/MATH-1296?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Anmol updated MATH-1296:
------------------------
Description:
@Test
public void test() {
DescriptiveStatistics stats = new DescriptiveStatistics();
stats.addValue(1);
stats.addValue(2);
stats.addValue(4);
System.out.println(stats.getGeometricMean()); //prints 2
stats.addValue(0);
System.out.println(stats.getGeometricMean()); //prints 0,
expected NaN as per the documentation
}
The class in consideration is:
org.apache.commons.math3.stat.descriptive.DescriptiveStatistics
was:
@Test
public void test() {
DescriptiveStatistics stats = new DescriptiveStatistics();
stats.addValue(1);
stats.addValue(2);
stats.addValue(4);
System.out.println(stats.getGeometricMean()); //prints 2
stats.addValue(0);
System.out.println(stats.getGeometricMean()); //prints 0,
expected NaN as per the documentation
}
> DescriptiveStatistics return geometric mean as 0 when product of values is
> zero, expected to return NaN
> -------------------------------------------------------------------------------------------------------
>
> Key: MATH-1296
> URL: https://issues.apache.org/jira/browse/MATH-1296
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.4.1
> Reporter: Anmol
> Priority: Trivial
> Labels: easyfix
> Original Estimate: 168h
> Remaining Estimate: 168h
>
> @Test
> public void test() {
> DescriptiveStatistics stats = new DescriptiveStatistics();
> stats.addValue(1);
> stats.addValue(2);
> stats.addValue(4);
> System.out.println(stats.getGeometricMean()); //prints 2
> stats.addValue(0);
> System.out.println(stats.getGeometricMean()); //prints 0,
> expected NaN as per the documentation
> }
> The class in consideration is:
> org.apache.commons.math3.stat.descriptive.DescriptiveStatistics
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)