Module: GyomuRuby::CoreExt::Numeric::Round
- Defined in:
- lib/gyomu_ruby/core_ext/numeric/round.rb
Instance Method Summary collapse
Instance Method Details
#rounddown(offset) ⇒ Object
9 10 11 |
# File 'lib/gyomu_ruby/core_ext/numeric/round.rb', line 9 def rounddown(offset) (self * Rational(1, offset)).floor * offset end |
#roundup(offset) ⇒ Object
5 6 7 |
# File 'lib/gyomu_ruby/core_ext/numeric/round.rb', line 5 def roundup(offset) ((self + offset) * Rational(1, offset)).ceil * offset - offset end |