Rollup merge of #41292 - est31:master, r=BurntSushi
Avoid to use floating point match Its going to be forbidden, see issue #41255.
This commit is contained in:
commit
c04ae0f0cf
@ -103,12 +103,14 @@ pub fn new(shape: f64, scale: f64) -> Gamma {
|
|||||||
assert!(shape > 0.0, "Gamma::new called with shape <= 0");
|
assert!(shape > 0.0, "Gamma::new called with shape <= 0");
|
||||||
assert!(scale > 0.0, "Gamma::new called with scale <= 0");
|
assert!(scale > 0.0, "Gamma::new called with scale <= 0");
|
||||||
|
|
||||||
let repr = match shape {
|
let repr = if shape == 1.0 {
|
||||||
1.0 => One(Exp::new(1.0 / scale)),
|
One(Exp::new(1.0 / scale))
|
||||||
0.0...1.0 => Small(GammaSmallShape::new_raw(shape, scale)),
|
} else if 0.0 <= shape && shape < 1.0 {
|
||||||
_ => Large(GammaLargeShape::new_raw(shape, scale)),
|
Small(GammaSmallShape::new_raw(shape, scale))
|
||||||
|
} else {
|
||||||
|
Large(GammaLargeShape::new_raw(shape, scale))
|
||||||
};
|
};
|
||||||
Gamma { repr: repr }
|
Gamma { repr }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user