Sha256: 644f2fa39de7715374d915ac910862d266acdf710fff1dc7be3c1c44f62ce066

Contents?: true

Size: 327 Bytes

Versions: 9

Compression:

Stored size: 327 Bytes

Contents

require_relative '../function'

Dentaku::AST::Function.register(:rounddown, :numeric, lambda { |numeric, precision = 0|
  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
})

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
dentaku-3.5.4 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.5.3 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.5.2 lib/dentaku/ast/functions/rounddown.rb
dentaku_zevo-3.5.2 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.5.1 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.5.0 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.4.2 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.4.1 lib/dentaku/ast/functions/rounddown.rb
dentaku-3.4.0 lib/dentaku/ast/functions/rounddown.rb