Fixed BigInt subtraction for equal operands
This commit is contained in:
parent
62887ad1d7
commit
18de900a38
11
UBigInt.pas
11
UBigInt.pas
|
@ -237,10 +237,17 @@ class function TBigInt.SubtractAbsoluteValues(constref AA, AB: TBigInt; const AR
|
|||
var
|
||||
a, b: TBigInt;
|
||||
carry: Cardinal;
|
||||
i, j, lastNonZeroDigitIndex, len: Integer;
|
||||
compare, i, j, lastNonZeroDigitIndex, len: Integer;
|
||||
begin
|
||||
// Establishes the operand order, such that Abs(a) is not less than Abs(b).
|
||||
if (AA.CompareToAbsoluteValues(AB) >= 0) then
|
||||
compare := AA.CompareToAbsoluteValues(AB);
|
||||
if compare = 0 then
|
||||
begin
|
||||
Result := Zero;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if compare > 0 then
|
||||
begin
|
||||
a := AA;
|
||||
b := AB;
|
||||
|
|
Loading…
Reference in New Issue