FIx for floating numbers

This commit is contained in:
Daniel van Noord
2020-12-03 19:00:27 +01:00
parent 74b353d530
commit ed814ef39a
2 changed files with 10 additions and 4 deletions

View File

@@ -1224,8 +1224,11 @@ CM.Disp.Beautify = function(num, frac, forced) {
}
num = num.toString();
var timesTenToPowerThree = Math.trunc(Math.log10(num) / 3)
if (timesTenToPowerThree < 2) {
answer = num;
if (num == "0") {
return num
}
else if (timesTenToPowerThree < 2) {
answer = Math.round(num * 100) / 100;
}
else if (CM.Config.Scale == 3 && !forced || forced == 3) { // Scientific notation, 123456789 => 1.235E+8
answer = num[0] + '.'

View File

@@ -342,8 +342,11 @@ CM.Disp.Beautify = function(num, frac, forced) {
}
num = num.toString();
var timesTenToPowerThree = Math.trunc(Math.log10(num) / 3)
if (timesTenToPowerThree < 2) {
answer = num;
if (num == "0") {
return num
}
else if (timesTenToPowerThree < 2) {
answer = Math.round(num * 100) / 100;
}
else if (CM.Config.Scale == 3 && !forced || forced == 3) { // Scientific notation, 123456789 => 1.235E+8
answer = num[0] + '.'