[ https://issues.apache.org/jira/browse/MATH-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bruno P. Kinoshita updated MATH-1431: ------------------------------------- Description: 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} was: 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. 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); > 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 > > 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 (v6.4.14#64029)