either it's slightly faster or it's a measurement error
This commit is contained in:
parent
3b3801ba0d
commit
8ffea918c4
@ -26,9 +26,12 @@ impl StationMeasurements {
|
|||||||
|
|
||||||
impl Display for StationMeasurements {
|
impl Display for StationMeasurements {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
let min = self.min as f64 / 10.0;
|
let min_pre = self.min / 10;
|
||||||
let max = self.max as f64 / 10.0;
|
let min_suf = (self.min % 10).abs();
|
||||||
|
let max_pre = self.max / 10;
|
||||||
|
let max_suf = (self.max % 10).abs();
|
||||||
|
// casting here is faster
|
||||||
let avg = (self.sum as f64 / self.count as f64) / 10.0;
|
let avg = (self.sum as f64 / self.count as f64) / 10.0;
|
||||||
write!(f, "{min}/{avg:.1}/{max}")
|
write!(f, "{min_pre}.{min_suf}/{avg:.1}/{max_pre}.{max_suf}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user