summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-27 17:30:34 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-27 17:30:34 -0400
commit12616dd030811b79b4e4270628fff3d478bf7074 (patch)
treeaa63d15c51c6f6aeb5384588598897dcda4512bc /src
parent3c30f74931bbe94484da82481eb9d3b788347907 (diff)
downloadfork-ledger-12616dd030811b79b4e4270628fff3d478bf7074.tar.gz
fork-ledger-12616dd030811b79b4e4270628fff3d478bf7074.tar.bz2
fork-ledger-12616dd030811b79b4e4270628fff3d478bf7074.zip
Fixed an error with post-simplified math
Diffstat (limited to 'src')
-rw-r--r--src/value.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/value.cc b/src/value.cc
index cd4c4aa1..23806d24 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -658,7 +658,18 @@ value_t& value_t::operator/=(const value_t& val)
return *this;
case BALANCE:
if (val.as_balance().single_amount()) {
- as_amount_lval() /= val.simplified().as_amount();
+ value_t simpler(val.simplified());
+ switch (simpler.type()) {
+ case INTEGER:
+ as_amount_lval() /= simpler.as_long();
+ break;
+ case AMOUNT:
+ as_amount_lval() /= simpler.as_amount();
+ break;
+ default:
+ assert(0);
+ break;
+ }
return *this;
}
break;