mirror of
https://github.com/ivabus/gui
synced 2025-04-23 14:07:14 +03:00
aim for 3 sig.fig.
This commit is contained in:
parent
46a907e85c
commit
732cb56860
1 changed files with 2 additions and 1 deletions
|
@ -25,7 +25,8 @@
|
|||
}
|
||||
|
||||
const N = n / divisor;
|
||||
const decimals = n < 10 ? 2 : 1; // it’s more informative to show more decimals but only for smaller numbers
|
||||
// going for 3 significant figures
|
||||
const decimals = N < 10 ? 2 : N < 100 ? 1 : 0;
|
||||
|
||||
return `${N.toFixed(decimals)} ${unit}`;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue