diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-30 12:09:31 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-30 12:09:31 +0000 |
commit | 8d3ff69d4fef0c79a6b4a71da5a05fa2afce9871 (patch) | |
tree | f20fa44dd498d56cd312f4a787471f144d561f3b | |
parent | 16969e4b5da82d012e5c332a20714e4647949131 (diff) | |
download | ruby-8d3ff69d4fef0c79a6b4a71da5a05fa2afce9871.tar.gz |
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
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | bignum.c | 8 | ||||
-rw-r--r-- | numeric.c | 4 |
3 files changed, 9 insertions, 9 deletions
@@ -1,3 +1,9 @@ +Sat Apr 30 21:01:20 2016 Tanaka Akira <akr@fsij.org> + + * numeric.c (rb_int_minus): Define Integer#-. + + * bignum.c (rb_big_minus): Don't define Bignum#-. + Sat Apr 30 20:53:33 2016 Tanaka Akira <akr@fsij.org> * numeric.c (rb_int_mul): Define Integer#*. @@ -5803,13 +5803,6 @@ rb_big_plus(VALUE x, VALUE y) } } -/* - * call-seq: - * big - other -> Numeric - * - * Subtracts other from big, returning the result. - */ - VALUE rb_big_minus(VALUE x, VALUE y) { @@ -6836,7 +6829,6 @@ Init_Bignum(void) rb_define_method(rb_cBignum, "coerce", rb_big_coerce, 1); rb_define_method(rb_cBignum, "+", rb_big_plus, 1); - rb_define_method(rb_cBignum, "-", rb_big_minus, 1); rb_define_method(rb_cBignum, "/", rb_big_div, 1); rb_define_method(rb_cBignum, "===", rb_big_eq, 1); @@ -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); |