Fix compile on 32-bit

Fix #3
This commit is contained in:
Eric Culp 2017-11-12 16:39:20 -08:00
parent e2e799e02a
commit d8d171e025

View File

@ -1,7 +1,7 @@
use core;
use core::cmp::min;
use conv::{ApproxFrom, ConvAsUtil, ValueFrom};
use conv::{ApproxFrom, ConvAsUtil, ConvUtil, ValueFrom};
use quickersort::sort_floats;
use super::Estimate;
@ -81,7 +81,7 @@ impl Quantile {
];
let len = usize::value_from(self.len()).unwrap(); // < 5
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();
if desired_index == index && index >= 0. {
let index: usize = index.approx().unwrap(); // < 5