meas: correctly render SI prefixes for negative numbers

the previous implementation treated negative numbers as effectively
having unknown magnitude, rendering them without any adjustment.
This commit is contained in:
2022-08-10 01:17:49 -07:00
parent e08c6dbaa3
commit 8a3a64face

View File

@@ -118,7 +118,7 @@ enum SiScale {
impl SiScale {
fn for_value(v: f32) -> Self {
use SiScale::*;
match v {
match v.abs() {
v if v < 1e-12 => Unit,
v if v < 1e-9 => Pico,
v if v < 1e-6 => Nano,