Skip to content

Commit 31f4201

Browse files
committed
🐛 parse unit u and μ as micro and truncate to 0
ISSUE #189
1 parent 7358e1e commit 31f4201

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/qty.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct Scale {
2727

2828
// should be sorted in DESC
2929
#[rustfmt::skip]
30-
static SCALES: [Scale;13] = [
30+
static SCALES: [Scale;15] = [
3131
Scale{ label:"Pi", base: 2, pow: 50},
3232
Scale{ label:"Ti", base: 2, pow: 40},
3333
Scale{ label:"Gi", base: 2, pow: 30},
@@ -40,6 +40,8 @@ static SCALES: [Scale;13] = [
4040
Scale{ label:"k", base: 10, pow: 3},
4141
Scale{ label:"", base: 10, pow: 0},
4242
Scale{ label:"m", base: 10, pow: -3},
43+
Scale{ label:"u", base: 10, pow: -6},
44+
Scale{ label:"μ", base: 10, pow: -6},
4345
Scale{ label:"n", base: 10, pow: -9},
4446
];
4547

@@ -316,6 +318,8 @@ mod tests {
316318
("1m", "1.0m"),
317319
("1000000n", "1000000.0n"),
318320
// lowest precision is m, under 1m value is trunked
321+
("1u", "0.0u"),
322+
("1μ", "0.0μ"),
319323
("1n", "0.0n"),
320324
("999999n", "0.0n"),
321325
];

0 commit comments

Comments
 (0)