Added floor() value expression function

This commit is contained in:
John Wiegley 2009-11-11 03:45:37 -05:00
parent e8ea2d4938
commit dae24c259b
2 changed files with 9 additions and 0 deletions

View file

@ -207,6 +207,12 @@ value_t report_t::fn_quantity(call_scope_t& scope)
return args.get<amount_t>(0).number();
}
value_t report_t::fn_floor(call_scope_t& scope)
{
interactive_t args(scope, "v");
return args.value_at(0).floored();
}
value_t report_t::fn_abs(call_scope_t& scope)
{
interactive_t args(scope, "v");
@ -735,6 +741,8 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind,
case 'f':
if (is_eq(p, "format_date"))
return MAKE_FUNCTOR(report_t::fn_format_date);
else if (is_eq(p, "floor"))
return MAKE_FUNCTOR(report_t::fn_floor);
break;
case 'g':

View file

@ -143,6 +143,7 @@ public:
value_t fn_rounded(call_scope_t& scope);
value_t fn_unrounded(call_scope_t& scope);
value_t fn_truncated(call_scope_t& scope);
value_t fn_floor(call_scope_t& scope);
value_t fn_abs(call_scope_t& scope);
value_t fn_justify(call_scope_t& scope);
value_t fn_quoted(call_scope_t& scope);