Fixed toDecimal() for large extended Int36 values (although there are still some very large values that trigger an error)

This commit is contained in:
Jeff Parsons 2017-02-15 23:43:23 -08:00 committed by Jeff Parsons
commit 048a10aac6
2 changed files with 27 additions and 13 deletions

View file

@ -151,6 +151,10 @@ class Int36 {
}
do {
var quotient = i36Tmp.div(i36Div);
if (i36Tmp.error) {
s = "error";
break;
}
var nMinDigits = (quotient? 10 : 1);
i36Tmp.value = i36Tmp.remainder;
do {
@ -158,6 +162,7 @@ class Int36 {
s = String.fromCharCode(0x30 + i36Tmp.remainder) + s;
} while (--nMinDigits > 0 || i36Tmp.value);
i36Tmp.value = quotient;
i36Tmp.extended = 0;
} while (i36Tmp.value);
if (fNeg) s = '-' + s;
return s;