This commit is contained in:
Daniël van Noord
2021-03-14 13:18:56 +01:00
parent 1bffb58782
commit 5f864d9055
6 changed files with 11 additions and 8 deletions

View File

@@ -27,11 +27,8 @@ export function Beautify(num, floats, forced) {
if (num === 0) {
return num.toString();
} if (num > 0.001 && num < CMOptions.ScaleCutoff) {
answer = num.toFixed(2);
if (CMOptions.ScaleSeparator) answer = answer.toLocaleString('nl');
for (let i = 0; i < 3; i++) {
if (answer[answer.length - 1] === '0' || answer[answer.length - 1] === '.') answer = answer.slice(0, -1);
}
if (CMOptions.ScaleSeparator) answer = num.toLocaleString('nl');
else answer = num.toLocaleString('en');
return answer;
} if (CMOptions.Scale === 4 && !forced || forced === 4) { // Scientific notation, 123456789 => 1.235E+8
answer = num.toExponential(decimals).toString().replace('e', 'E');