[ 
https://issues.apache.org/jira/browse/MATH-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gilles Sadowski resolved MATH-1431.
-----------------------------------
    Fix Version/s: 4.0
       Resolution: Fixed

Unit test and fix provided in [PR 
#79|https://github.com/apache/commons-math/pull/79] that never made it to 
here...

Commit 9d4d838638c7ee0c6f89c8061e89ed08171ee304 (in "master" branch).

> EmpiricalDistribution cumulativeProbability can return NaN when evaluated 
> within an empty bin.
> ----------------------------------------------------------------------------------------------
>
>                 Key: MATH-1431
>                 URL: https://issues.apache.org/jira/browse/MATH-1431
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>            Reporter: Jay
>            Priority: Major
>             Fix For: 4.0
>
>
> The NaN can be reproduced by the following program. Evaluating at x = 0.3, it 
> appeared that getkernel returned a NormalDistribution with mean of NaN and 
> standardDeviation of NaN.
> {code:java}
>     final int len = 240000;
>     double[] data = new double[len];
>     for (int i = 0; i < len / 2; ++i) {
>         data[i] = 0;
>     }
>     for (int i = len / 2 + 1; i < len ; ++i) {
>         data[i] = 1;
>     }
>     int binCnt = Math.max(1, data.length / 10);
>     EmpiricalDistribution edist = new EmpiricalDistribution(binCnt);
>     edist.load(data);
>     double x = 0.3;
>     double y = edist.cumulativeProbability(x);
>     System.out.println("y is " + y);
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to