parent
e2e799e02a
commit
d8d171e025
@ -1,7 +1,7 @@
|
|||||||
use core;
|
use core;
|
||||||
use core::cmp::min;
|
use core::cmp::min;
|
||||||
|
|
||||||
use conv::{ApproxFrom, ConvAsUtil, ValueFrom};
|
use conv::{ApproxFrom, ConvAsUtil, ConvUtil, ValueFrom};
|
||||||
use quickersort::sort_floats;
|
use quickersort::sort_floats;
|
||||||
|
|
||||||
use super::Estimate;
|
use super::Estimate;
|
||||||
@ -81,7 +81,7 @@ impl Quantile {
|
|||||||
];
|
];
|
||||||
let len = usize::value_from(self.len()).unwrap(); // < 5
|
let len = usize::value_from(self.len()).unwrap(); // < 5
|
||||||
sort_floats(&mut heights[..len]);
|
sort_floats(&mut heights[..len]);
|
||||||
let desired_index = f64::approx_from(len).unwrap() * self.p() - 1.;
|
let desired_index = ConvUtil::approx_as::<f64>(len).unwrap() * self.p() - 1.;
|
||||||
let mut index = desired_index.ceil();
|
let mut index = desired_index.ceil();
|
||||||
if desired_index == index && index >= 0. {
|
if desired_index == index && index >= 0. {
|
||||||
let index: usize = index.approx().unwrap(); // < 5
|
let index: usize = index.approx().unwrap(); // < 5
|
||||||
|
Loading…
Reference in New Issue
Block a user