Compare commits
1 Commits
v7.0.0
...
feat/spell
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9ca3b6253 |
1
game.js
1
game.js
@@ -685,6 +685,7 @@ function fmt(n) {
|
||||
if (n < 0) return '-' + fmt(-n);
|
||||
if (n < 1000) return Math.floor(n).toLocaleString();
|
||||
const scale = Math.floor(Math.log10(n) / 3);
|
||||
if (scale >= 12) return spellf(n);
|
||||
if (scale >= NUMBER_ABBREVS.length) return n.toExponential(2);
|
||||
const abbrev = NUMBER_ABBREVS[scale];
|
||||
return (n / Math.pow(10, scale * 3)).toFixed(1) + abbrev;
|
||||
|
||||
Reference in New Issue
Block a user