summaryrefslogtreecommitdiff
path: root/src/amount.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-27 15:23:38 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-27 15:23:38 -0400
commitf881bf131985b52566e606f34b07f5f3c4df244c (patch)
tree444f9c5ddd3822c96705c457276305635d6d38b4 /src/amount.cc
parentafe3a899c6a6e2cdd01fcf55c5f8ce62a1ef8b8c (diff)
downloadfork-ledger-f881bf131985b52566e606f34b07f5f3c4df244c.tar.gz
fork-ledger-f881bf131985b52566e606f34b07f5f3c4df244c.tar.bz2
fork-ledger-f881bf131985b52566e606f34b07f5f3c4df244c.zip
Fix to amount unreduction (aka, 120m -> 2h)
Diffstat (limited to 'src/amount.cc')
-rw-r--r--src/amount.cc7
1 files changed, 4 insertions, 3 deletions
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) {