diff --git a/src/main/rust/src/models/station_measurements.rs b/src/main/rust/src/models/station_measurements.rs index 5c89597..7312ccd 100644 --- a/src/main/rust/src/models/station_measurements.rs +++ b/src/main/rust/src/models/station_measurements.rs @@ -26,9 +26,12 @@ impl StationMeasurements { impl Display for StationMeasurements { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let min = self.min as f64 / 10.0; - let max = self.max as f64 / 10.0; + let min_pre = self.min / 10; + 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; - write!(f, "{min}/{avg:.1}/{max}") + write!(f, "{min_pre}.{min_suf}/{avg:.1}/{max_pre}.{max_suf}") } }