Added test to verify that zero variance in either array leads to NaN.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1540392 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2013-11-09 20:31:52 +00:00
parent d252a811a2
commit eca87abcee
1 changed files with 1 additions and 0 deletions

View File

@ -194,6 +194,7 @@ public class PearsonsCorrelationTest {
double[] noVariance = new double[] {1, 1, 1, 1};
double[] values = new double[] {1, 2, 3, 4};
Assert.assertTrue(Double.isNaN(new PearsonsCorrelation().correlation(noVariance, values)));
Assert.assertTrue(Double.isNaN(new PearsonsCorrelation().correlation(values, noVariance)));
}