From 8d3ff69d4fef0c79a6b4a71da5a05fa2afce9871 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 30 Apr 2016 12:09:31 +0000 Subject: Define Integer#- instead of Bignum#-. * numeric.c (rb_int_minus): Define Integer#-. * bignum.c (rb_big_minus): Don't define Bignum#-. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- numeric.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'numeric.c') diff --git a/numeric.c b/numeric.c index 8a098d0a30..be66fd0685 100644 --- a/numeric.c +++ b/numeric.c @@ -3279,9 +3279,10 @@ rb_int_plus(VALUE x, VALUE y) } /* + * Document-method: Integer#- * Document-method: Fixnum#- * call-seq: - * fix - numeric -> numeric_result + * int - numeric -> numeric_result * * Performs subtraction: the class of the resulting object depends on the class * of +numeric+ and on the magnitude of the result. It may return a Bignum. @@ -4940,6 +4941,7 @@ Init_Numeric(void) rb_define_method(rb_cInteger, "-@", rb_int_uminus, 0); rb_define_method(rb_cFixnum, "+", fix_plus, 1); rb_define_method(rb_cFixnum, "-", fix_minus, 1); + rb_define_method(rb_cInteger, "-", rb_int_minus, 1); rb_define_method(rb_cFixnum, "*", fix_mul, 1); rb_define_method(rb_cInteger, "*", rb_int_mul, 1); rb_define_method(rb_cFixnum, "/", fix_div, 1); -- cgit v1.2.3