Panic for invalid p values
This commit is contained in:
parent
95a2a1d409
commit
64a08a073a
@ -16,8 +16,11 @@ pub struct Quantile {
|
|||||||
|
|
||||||
impl Quantile {
|
impl Quantile {
|
||||||
/// Create a new p-quantile estimator.
|
/// Create a new p-quantile estimator.
|
||||||
|
///
|
||||||
|
/// Panics if `p` is not between 0 and 1.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(p: f64) -> Quantile {
|
pub fn new(p: f64) -> Quantile {
|
||||||
|
assert!(0. <= p && p <= 1.);
|
||||||
Quantile {
|
Quantile {
|
||||||
q: [0.; 5],
|
q: [0.; 5],
|
||||||
n: [1, 2, 3, 4, 0],
|
n: [1, 2, 3, 4, 0],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user