Skip to main content

check_confidence

Function check_confidence 

Source
pub fn check_confidence(c: f64, what: &str) -> Result<()>
Expand description

Check a confidence level: a probability strictly between 0 and 1 (0.95, not 95), what naming where it was given.

§Errors

Error::Config for a level outside $(0, 1)$ or not a number.

§Examples

use comnum_sim::stopping::check_confidence;
assert!(check_confidence(0.95, "confidence").is_ok());
let e = check_confidence(95.0, "confidence").unwrap_err().to_string();
assert!(e.contains("between 0 and 1"), "{e}");