summaryrefslogtreecommitdiff
path: root/src/report.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-19 00:41:32 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-19 00:41:32 -0500
commitcd50fe054794d89253fce26daa685e2043428873 (patch)
tree467834b12d2bf0b446915c4069b98c018c3a7ea1 /src/report.cc
parent60a281a55a2fd009723c291c6e665b0de743f062 (diff)
downloadfork-ledger-cd50fe054794d89253fce26daa685e2043428873.tar.gz
fork-ledger-cd50fe054794d89253fce26daa685e2043428873.tar.bz2
fork-ledger-cd50fe054794d89253fce26daa685e2043428873.zip
More improvements to nail_down; fixes #715
Diffstat (limited to 'src/report.cc')
-rw-r--r--src/report.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/report.cc b/src/report.cc
index 28836d0f..21fc9c1b 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -813,10 +813,12 @@ value_t report_t::fn_nail_down(call_scope_t& args)
switch (arg0.type()) {
case value_t::AMOUNT: {
amount_t tmp(arg0.as_amount());
- if (tmp.has_commodity() && ! arg1.is_null()) {
+ if (tmp.has_commodity() && ! tmp.is_null() && ! tmp.is_realzero()) {
+ arg1 = arg1.strip_annotations(keep_details_t()).to_amount();
expr_t value_expr(is_expr(arg1) ?
as_expr(arg1) :
- expr_t::op_t::wrap_value(arg1.unrounded() / arg0));
+ expr_t::op_t::wrap_value(arg1.unrounded() /
+ arg0.number()));
std::ostringstream buf;
value_expr.print(buf);
value_expr.set_text(buf.str());