This crate provides lookup functions for the standard normal table, also called Z table. Because the lookup functions are const
, they can be evaluated at compile time.
```rust use ztable::lookupwith;
fn main() {
// Some birth weights newborns in kg.
let birthweights: [f32; 5] = [2.5, 2.7, 3.1, 3.4, 3.6];
let n = birthweights.len() as f32;
// Calculate the average weight of a newborn.
let mean: f32 = birthweights.iter().sum::
println!(
"The probability of a newborn to weight more than 3.5 kg is {}%",
(1.0 - lookup_with(3.5, mean, standard_derivation)) * 100.0
);
}
```