diff --git a/src/main/java/org/apache/commons/math/stat/Frequency.java b/src/main/java/org/apache/commons/math/stat/Frequency.java index c45d72883..68c8bf2de 100644 --- a/src/main/java/org/apache/commons/math/stat/Frequency.java +++ b/src/main/java/org/apache/commons/math/stat/Frequency.java @@ -300,7 +300,7 @@ public class Frequency implements Serializable { */ @Deprecated public double getPct(Object v) { - return getCumPct((Comparable) v); + return getPct((Comparable) v); } /** diff --git a/src/site/xdoc/changes.xml b/src/site/xdoc/changes.xml index 6ed488994..44acbcab6 100644 --- a/src/site/xdoc/changes.xml +++ b/src/site/xdoc/changes.xml @@ -39,6 +39,10 @@ The type attribute can be add,update,fix,remove. + + Fixed regression in Frequency.getPct(Object) introduced in 2.0. Cumulative + percent was being returned for Object arguments in place of percent. + Singular Value Decomposition now computes either the compact SVD (using only positive singular values) or truncated SVD (using a user-specified maximal diff --git a/src/test/java/org/apache/commons/math/stat/FrequencyTest.java b/src/test/java/org/apache/commons/math/stat/FrequencyTest.java index 4fcbe2b5c..f216edaf8 100644 --- a/src/test/java/org/apache/commons/math/stat/FrequencyTest.java +++ b/src/test/java/org/apache/commons/math/stat/FrequencyTest.java @@ -144,6 +144,8 @@ public final class FrequencyTest extends TestCase { assertEquals("one pct",0.25,f.getPct(1),tolerance); assertEquals("two pct",0.25,f.getPct(Long.valueOf(2)),tolerance); assertEquals("three pct",0.5,f.getPct(threeL),tolerance); + // MATH-329 + assertEquals("three (Object) pct",0.5,f.getPct((Object) (Integer.valueOf(3))),tolerance); assertEquals("five pct",0,f.getPct(5),tolerance); assertEquals("foo pct",0,f.getPct("foo"),tolerance); assertEquals("one cum pct",0.25,f.getCumPct(1),tolerance);