mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Add min and max, closes #3
This commit is contained in:
1 parent
05e5899643
commit
0047938349
3 files changed
+41
-13
No files matched your search
@@ -66,3 +66,19 @@ impl fmt::Display for Warnings {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A max function for f64's without NaNs
|
||||
pub fn max(vals: &[f64]) -> f64 {
|
||||
vals.iter()
|
||||
.max_by(|a, b| a.partial_cmp(b).unwrap())
|
||||
.unwrap()
|
||||
.clone()
|
||||
}
|
||||
|
||||
/// A min function for f64's without NaNs
|
||||
pub fn min(vals: &[f64]) -> f64 {
|
||||
vals.iter()
|
||||
.min_by(|a, b| a.partial_cmp(b).unwrap())
|
||||
.unwrap()
|
||||
.clone()
|
||||
}
|
||||
Reference in new issue
Block a user