lib/dentaku/ast/functions/rounddown.rb in dentaku-3.3.4 vs lib/dentaku/ast/functions/rounddown.rb in dentaku-3.4.0
- old
+ new
@@ -1,8 +1,8 @@
require_relative '../function'
Dentaku::AST::Function.register(:rounddown, :numeric, lambda { |numeric, precision = 0|
- precision = precision.to_i
+ precision = Dentaku::AST::Function.numeric(precision || 0).to_i
tens = 10.0**precision
result = (Dentaku::AST::Function.numeric(numeric) * tens).floor / tens
precision <= 0 ? result.to_i : result
})