Fixed regression in Frequency.getPct(Object) introduced in 2.0. Cumulative

percent was being returned for Object arguments in place of percent.

JIRA: MATH-329
Reported by Will Wu

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@900016 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2010-01-16 20:01:17 +00:00
parent b2f3f6db41
commit 6dd3724b9b
3 changed files with 7 additions and 1 deletions

View File

@ -300,7 +300,7 @@ public class Frequency implements Serializable {
*/
@Deprecated
public double getPct(Object v) {
return getCumPct((Comparable<?>) v);
return getPct((Comparable<?>) v);
}
/**

View File

@ -39,6 +39,10 @@ The <action> type attribute can be add,update,fix,remove.
</properties>
<body>
<release version="2.1" date="TBD" description="TBD">
<action dev="psteitz" type="fix" issue="MATH-329">
Fixed regression in Frequency.getPct(Object) introduced in 2.0. Cumulative
percent was being returned for Object arguments in place of percent.
</action>
<action dev="luc" type="add" issue="MATH-321" >
Singular Value Decomposition now computes either the compact SVD (using only
positive singular values) or truncated SVD (using a user-specified maximal

View File

@ -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);