You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "David Georg Reichelt (JIRA)" <ji...@apache.org> on 2015/09/30 12:00:07 UTC

[jira] [Updated] (MATH-1279) Avoid unexpected errors in EmpiricalDistribution

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

David Georg Reichelt updated MATH-1279:
---------------------------------------
    Description: 
Loading an empirical distributions results in an ArrayIndexOutOfBoundsException when giving 0 as bin size, for example in:

double values[] = new double[] { 1, 2 };
EmpiricalDistribution distribution = new EmpiricalDistribution(0);
distribution.load(values);

To keep the error more understandable to the user, it would be nice if an RuntimeException or something like this would be thrown when initializing the EmpiricalDistribution with 0 bins. Especially when following the rule of thumb that there should be values size / 10 bins, it is hard to find out that the error is caused by a wrong bin size and not by some error in the load-call.

  was:
Loading an empirical distributions results in an ArrayIndexOutOfBoundsException when giving 0 als bin size, for example in:

double values[] = new double[] { 1, 2 };
EmpiricalDistribution distribution = new EmpiricalDistribution(0);
distribution.load(values);

To keep the error more understandable to the user, it would be nice if an RuntimeException or something like this would be thrown when initializing the EmpiricalDistribution with 0 bins. Especially when following the rule of thumb that there should be values size / 10 bins, it is hard to find out that the error is caused by a wrong bin size.


> Avoid unexpected errors in EmpiricalDistribution
> ------------------------------------------------
>
>                 Key: MATH-1279
>                 URL: https://issues.apache.org/jira/browse/MATH-1279
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.5
>         Environment: Ubuntu 14.04
>            Reporter: David Georg Reichelt
>            Priority: Trivial
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Loading an empirical distributions results in an ArrayIndexOutOfBoundsException when giving 0 as bin size, for example in:
> double values[] = new double[] { 1, 2 };
> EmpiricalDistribution distribution = new EmpiricalDistribution(0);
> distribution.load(values);
> To keep the error more understandable to the user, it would be nice if an RuntimeException or something like this would be thrown when initializing the EmpiricalDistribution with 0 bins. Especially when following the rule of thumb that there should be values size / 10 bins, it is hard to find out that the error is caused by a wrong bin size and not by some error in the load-call.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)