Panic for invalid p values

This commit is contained in:
Vinzent Steinberg 2017-05-25 18:38:37 +02:00
parent 95a2a1d409
commit 64a08a073a

View File

@ -16,8 +16,11 @@ pub struct Quantile {
impl Quantile {
/// Create a new p-quantile estimator.
///
/// Panics if `p` is not between 0 and 1.
#[inline]
pub fn new(p: f64) -> Quantile {
assert!(0. <= p && p <= 1.);
Quantile {
q: [0.; 5],
n: [1, 2, 3, 4, 0],