From f881bf131985b52566e606f34b07f5f3c4df244c Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 27 Feb 2009 15:23:38 -0400 Subject: Fix to amount unreduction (aka, 120m -> 2h) --- src/amount.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/amount.cc b/src/amount.cc index 70ffd603..a6c1eb35 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -507,11 +507,12 @@ void amount_t::in_place_unreduce() bool shifted = false; while (comm && comm->larger()) { - temp /= comm->larger()->number(); - if (temp.abs() < amount_t(1L)) + amount_t next_temp = temp / comm->larger()->number(); + if (next_temp.abs() < amount_t(1L)) break; - shifted = true; + temp = next_temp; comm = comm->larger()->commodity_; + shifted = true; } if (shifted) { -- cgit v1.2.3