Skip to content
Myr

Preserve the median precondition from master

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Peter · committed by David Peter · parent 6af615c · Browse files · 1 file+4 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−0 removed

  • other:+4 added−0 removed

1 file+4 added−0 removed

modified:src/quantity/statistics.rs+4 added
45 unmodified lines
46 Q: Copy + PartialOrd + Add<Output = Q> + Div<Ratio, Output = P>,47 P: Into<Q>,48{49 let mut values = values.into_iter().collect::<Vec<_>>();50 assert!(51 !values.is_empty(),52 "median requires at least one measurement"53 );54 values.sort_by(|a, b| a.partial_cmp(b).expect("No NaN values"));5556 let len = values.len();57 if len % 2 == 0 {
173 unmodified lines