Sha256: 5c29265ebb7dde3394939aec9f1492a1102543ad70b5e6c8311b6529dd20577d

Contents?: true

Size: 290 Bytes

Versions: 9

Compression:

Stored size: 290 Bytes

Contents

require_relative '../function'

Dentaku::AST::Function.register(:rounddown, :numeric, lambda { |numeric, precision = 0|
  precision = precision.to_i
  tens = 10.0**precision
  result = (Dentaku::AST::Function.numeric(numeric) * tens).floor / tens
  precision <= 0 ? result.to_i : result
})

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dentaku-3.3.4 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.3.3 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.3.2 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.3.1 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.3.0 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.2.1 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.2.0 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.1.0 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.0.0 lib/dentaku/ast/functions/rounddown.rb