File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
java/org/apache/commons/math/stat/univariate/rank
test/org/apache/commons/math/stat/univariate/rank Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 57
57
import org .apache .commons .math .stat .univariate .AbstractUnivariateStatistic ;
58
58
59
59
/**
60
- * @version $Revision: 1.6 $ $Date: 2003/10/13 08:10:58 $
60
+ * @version $Revision: 1.7 $ $Date: 2003/10/16 15:15:04 $
61
61
*/
62
62
public class Percentile extends AbstractUnivariateStatistic {
63
63
@@ -145,7 +145,7 @@ public double evaluate(
145
145
if (pos < 1 ) {
146
146
return sorted [0 ];
147
147
}
148
- if (pos > n ) {
148
+ if (pos >= n ) {
149
149
return sorted [length - 1 ];
150
150
}
151
151
double lower = sorted [intPos - 1 ];
Original file line number Diff line number Diff line change 61
61
62
62
/**
63
63
* Test cases for the {@link UnivariateStatistic} class.
64
- * @version $Revision: 1.4 $ $Date: 2003/10/13 08:08:39 $
64
+ * @version $Revision: 1.5 $ $Date: 2003/10/16 15:15:04 $
65
65
*/
66
66
public class PercentileTest extends UnivariateStatisticAbstractTest {
67
67
@@ -99,4 +99,9 @@ public double expectedValue() {
99
99
return 20.82 ;
100
100
}
101
101
102
+ public void testHighPercentile (){
103
+ double [] d = new double []{1 , 2 , 3 };
104
+ Percentile p = new Percentile (75 );
105
+ assertEquals (3.0 , p .evaluate (d ), 1.0e-5 );
106
+ }
102
107
}
You can’t perform that action at this time.
0 commit comments