Merge pull request #1791 from iij/pr-numeric-div

add Integer#div and Float#div to mruby-numeric-ext
This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-03-04 17:31:16 +09:00
2 changed files with 13 additions and 0 deletions
@@ -0,0 +1,5 @@
module Integral
def div(other)
self.divmod(other)[0]
end
end
@@ -13,3 +13,11 @@ assert('Integer#chr') do
assert_raise(RangeError) { 256.chr }
end
end
assert('Integer#div') do
assert_equal 52, 365.div(7)
end
assert('Float#div') do
assert_float 52, 365.2425.div(7)
end