From 092bda14359d414e1b1e62184cc4d927a4154348 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 15 Jun 2009 17:40:17 +0100 Subject: Don't increase precision so much when dividing Slow the increase in internal precision when dividing amounts. Use "--debug amount.convert" if you wish to see this logic in action, if a case where incorrect rounding is suspected comes up. Fixes B68FFB0D-A9A0-479C-A6C0-68853F229333 --- src/amount.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/amount.cc') diff --git a/src/amount.cc b/src/amount.cc index a58cc215..ee241796 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -343,8 +343,8 @@ amount_t& amount_t::operator*=(const amount_t& amt) _dup(); mpq_mul(MP(quantity), MP(quantity), MP(amt.quantity)); - quantity->prec = static_cast(quantity->prec + - amt.quantity->prec); + quantity->prec = + static_cast(quantity->prec + amt.quantity->prec); if (! has_commodity()) commodity_ = amt.commodity_; @@ -382,7 +382,7 @@ amount_t& amount_t::operator/=(const amount_t& amt) mpq_div(MP(quantity), MP(quantity), MP(amt.quantity)); quantity->prec = static_cast(quantity->prec + amt.quantity->prec + - quantity->prec + extend_by_digits); + extend_by_digits); if (! has_commodity()) commodity_ = amt.commodity_; -- cgit v1.2.3