summaryrefslogtreecommitdiff
path: root/src/report.cc
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-01-30 18:56:00 -0800
committerCraig Earls <enderw88@gmail.com>2013-01-30 18:56:00 -0800
commitd9b1258c3480f79a0413cf4c5d07c6818c140503 (patch)
treec3416c163e9f13b1fdd2a5ccc3400375723e7aac /src/report.cc
parentb21ee1de170f99e8ed5c82546c8ae69e209bd8d6 (diff)
parent0df13661686dfec66aa0d5a8dd88920e1e104fbc (diff)
downloadfork-ledger-d9b1258c3480f79a0413cf4c5d07c6818c140503.tar.gz
fork-ledger-d9b1258c3480f79a0413cf4c5d07c6818c140503.tar.bz2
fork-ledger-d9b1258c3480f79a0413cf4c5d07c6818c140503.zip
Merge pull request #140 from enderw88/Bug634-floor-ceil-round
Bug 634 Added roundto function, optimized floor and ceiling
Diffstat (limited to 'src/report.cc')
-rw-r--r--src/report.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/report.cc b/src/report.cc
index 80993515..d90d22e4 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -691,6 +691,12 @@ value_t report_t::fn_round(call_scope_t& args)
return args[0].rounded();
}
+value_t report_t::fn_roundto(call_scope_t& args)
+{
+ if(args.has<int>(1))
+ return args[0].roundto(args.get<int>(1));
+}
+
value_t report_t::fn_unround(call_scope_t& args)
{
return args[0].unrounded();
@@ -1435,6 +1441,8 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind,
return WRAP_FUNCTOR(fn_red);
else if (is_eq(p, "round"))
return MAKE_FUNCTOR(report_t::fn_round);
+ else if (is_eq(p, "roundto"))
+ return MAKE_FUNCTOR(report_t::fn_roundto);
break;
case 's':