commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MATH-1296) DescriptiveStatistics return geometric mean as 0 when product of values is zero, expected to return NaN
Date Wed, 02 Dec 2015 12:03:10 GMT

    [ https://issues.apache.org/jira/browse/MATH-1296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15035696#comment-15035696
] 

Gilles commented on MATH-1296:
------------------------------

The documentation is wrong (in {{DescriptiveStatistics}} and in {{GeometricMean}} classes).
When one of the values is zero, the [geometric mean|http://mathworld.wolfram.com/GeometricMean.html]
should be 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)

Mime
View raw message