From c8a7361e45e3a149b970ae9cd74cbbcfbfd1d501 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 31 Jul 2001 06:24:45 +0000 Subject: * marshal.c (Init_marshal): new constant Marshal::MAJOR_VERSION and Marshal::MINOR_VERSION. * marshal.c (marshal_load): ruby_verbose test should be wrapped by RTEST(). * hash.c (rb_hash_index): should return nil (not the default value) if value is not in the hash. * numeric.c (num_div): new method added. alias to '/' which should be preserved even if '/' is redefined (e.g. by mathn). [new] * bignum.c (rb_cstr2inum): "0 ff".hex should return 0, not 255. * file.c (rb_file_s_expand_path): fixed using CharNext(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- numeric.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'numeric.c') diff --git a/numeric.c b/numeric.c index 55ab2a8118..027ee6366b 100644 --- a/numeric.c +++ b/numeric.c @@ -115,6 +115,13 @@ num_uminus(num) return rb_funcall(zero, '-', 1, num); } +static VALUE +num_div(x, y) + VALUE x, y; +{ + return rb_funcall(x, '/', 1, y); +} + static VALUE num_divmod(x, y) VALUE x, y; @@ -1543,6 +1550,7 @@ Init_Numeric() rb_define_method(rb_cNumeric, "-@", num_uminus, 0); rb_define_method(rb_cNumeric, "===", num_equal, 1); rb_define_method(rb_cNumeric, "eql?", num_eql, 1); + rb_define_method(rb_cNumeric, "div", num_div, 1); rb_define_method(rb_cNumeric, "divmod", num_divmod, 1); rb_define_method(rb_cNumeric, "modulo", num_modulo, 1); rb_define_method(rb_cNumeric, "remainder", num_remainder, 1); @@ -1591,6 +1599,7 @@ Init_Numeric() rb_define_method(rb_cFixnum, "-", fix_minus, 1); rb_define_method(rb_cFixnum, "*", fix_mul, 1); rb_define_method(rb_cFixnum, "/", fix_div, 1); + rb_define_method(rb_cFixnum, "div", fix_div, 1); rb_define_method(rb_cFixnum, "%", fix_mod, 1); rb_define_method(rb_cFixnum, "modulo", fix_mod, 1); rb_define_method(rb_cFixnum, "divmod", fix_divmod, 1); -- cgit v1.2.3