Measurement: don't use SI prefix if there's no unit

This commit is contained in:
2022-07-30 21:21:46 -07:00
parent b5c58c03ce
commit 5362dacf3a

View File

@@ -76,7 +76,11 @@ impl Measurement {
use MeasurementValue::*;
match self.value {
Field(v) => format!("{}{}", v, self.unit),
Float(f) => SiScale::format_short(f, &self.unit),
Float(f) => if self.unit != "" {
SiScale::format_short(f, &self.unit)
} else {
f.to_string()
},
Int(u) => format!("{}{}", u, self.unit),
Dim(v) => format!("{}x{}x{}{}", v.x(), v.y(), v.z(), self.unit),
}