Skip to content

Commit

Permalink
Define Integer#* instead of Bignum#*.
Browse files Browse the repository at this point in the history
* numeric.c (rb_int_mul): Define Integer#*.

* bignum.c (rb_big_mul): Don't define Bignum#*.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
akr committed Apr 30, 2016
1 parent e27a06f commit a9f3a1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Sat Apr 30 20:53:33 2016 Tanaka Akira <akr@fsij.org>

* numeric.c (rb_int_mul): Define Integer#*.

* bignum.c (rb_big_mul): Don't define Bignum#*.

Sat Apr 30 20:30:44 2016 Tanaka Akira <akr@fsij.org>

* numeric.c (rb_int_modulo): Define Integer#%.
Expand Down
8 changes: 0 additions & 8 deletions bignum.c
Original file line number Diff line number Diff line change
Expand Up @@ -5897,13 +5897,6 @@ bigmul0(VALUE x, VALUE y)
return z;
}

/*
* call-seq:
* big * other -> Numeric
*
* Multiplies big and other, returning the result.
*/

VALUE
rb_big_mul(VALUE x, VALUE y)
{
Expand Down Expand Up @@ -6844,7 +6837,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_mul, 1);
rb_define_method(rb_cBignum, "/", rb_big_div, 1);

rb_define_method(rb_cBignum, "===", rb_big_eq, 1);
Expand Down
4 changes: 3 additions & 1 deletion numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -3331,9 +3331,10 @@ rb_int_minus(VALUE x, VALUE y)
#define FIT_SQRT_LONG(n) (((n)<SQRT_LONG_MAX)&&((n)>=-SQRT_LONG_MAX))

/*
* Document-method: Integer#*
* Document-method: Fixnum#*
* call-seq:
* fix * numeric -> numeric_result
* int * numeric -> numeric_result
*
* Performs multiplication: the class of the resulting object depends on the
* class of +numeric+ and on the magnitude of the result. It may return a
Expand Down Expand Up @@ -4940,6 +4941,7 @@ Init_Numeric(void)
rb_define_method(rb_cFixnum, "+", fix_plus, 1);
rb_define_method(rb_cFixnum, "-", fix_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);
rb_define_method(rb_cInteger, "div", rb_int_idiv, 1);
rb_define_method(rb_cFixnum, "%", fix_mod, 1);
Expand Down

0 comments on commit a9f3a1c

Please sign in to comment.