[
https://issues.apache.org/jira/browse/MATH-1296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15035716#comment-15035716
]
Anmol commented on MATH-1296:
-----------------------------
MS Excel returns not a number too when any value is zero in the set.
Documentation is inconsistent at a couple of other places too:
1) getKustosis() returns NaN when <= 3 values are added, but documentation says
it will return 0
2) getSkewness() returns NaN when <=2 values are added, but documentation says
it will return 0
> 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)