diff --git a/Samples/Bernoulli/BigBernoulli.dpr b/Samples/Bernoulli/BigBernoulli.dpr index fc45744..41d65ec 100644 --- a/Samples/Bernoulli/BigBernoulli.dpr +++ b/Samples/Bernoulli/BigBernoulli.dpr @@ -74,7 +74,7 @@ begin end; finally lines.Free; - check.Free + check.Free; end; except diff --git a/Source/Velthuis.BigDecimals.pas b/Source/Velthuis.BigDecimals.pas index b9c9e55..a17c2e7 100644 --- a/Source/Velthuis.BigDecimals.pas +++ b/Source/Velthuis.BigDecimals.pas @@ -1135,11 +1135,12 @@ class procedure BigDecimal.InPlaceRemoveTrailingZeros(var Value: BigDecimal; Tar if (LScale > TargetScale) and (LValue >= BigInteger.Ten) then begin BigInteger.DivMod(LValue, BigInteger.Ten, LQuotient, LRemainder); + if LRemainder.IsZero then begin LValue := LQuotient; Dec(LScale); - end + end; end; LValue.Sign := LSign;