Skip to content

Commit 444b609

Browse files
committed
Fix Nearest interpolation strategy
1 parent 0070d88 commit 444b609

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/percentile.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ pub mod interpolate {
9292

9393
impl<T> Interpolate<T> for Nearest {
9494
fn needs_lower(q: f64, len: usize) -> bool {
95-
let lower = <Self as Interpolate<T>>::lower_index(q, len);
96-
((lower as f64) - <Self as Interpolate<T>>::float_percentile_index(q, len)) <= 0.
95+
<Self as Interpolate<T>>::float_percentile_index_fraction(q, len) < 0.5
9796
}
9897
fn needs_upper(q: f64, len: usize) -> bool {
9998
!<Self as Interpolate<T>>::needs_lower(q, len)

0 commit comments

Comments
 (0)