Skip to content

Commit

Permalink
Fixes #1529. Fixed: Incorrect CPDecimalNumber result for 220000/220.
Browse files Browse the repository at this point in the history
And in general divisions where the quotient had fewer digits than the dividend when disregarding exponent would fail.

We want to stop dividing when we've gone over all the digits in the dividend and the remainder is 0.
  • Loading branch information
aljungberg committed May 9, 2012
1 parent 82e2c7a commit 8aaf298
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Foundation/CPDecimal.j
Expand Up @@ -765,7 +765,7 @@ function _SimpleDivide(result, leftOperand, rightOperand, roundingMode)

n1._mantissa = [];

while ((k < leftOperand._mantissa.length) || (n1._mantissa.length
while ((used < leftOperand._mantissa.length) || (n1._mantissa.length
&& !((n1._mantissa.length == 1) && (n1._mantissa[0] == 0))))
{
while (CPOrderedAscending == CPDecimalCompare(n1, rightOperand))
Expand Down

0 comments on commit 8aaf298

Please sign in to comment.