From 12616dd030811b79b4e4270628fff3d478bf7074 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 27 Oct 2009 17:30:34 -0400 Subject: [PATCH] Fixed an error with post-simplified math --- src/value.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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;