summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-30 11:54:26 (GMT)
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-30 11:54:26 (GMT)
commita9f3a1cda13c78e893f841fc08b21a17afe64b16 (patch)
tree7621dbb49c4f054326c50021b3b6162ecc53d7c5 /numeric.c
parente27a06f4bbf0723cd19a943c41dff3125ed0a69d (diff)
Define Integer#* instead of Bignum#*.
* 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
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index c20ce4f..8a098d0 100644
--- a/numeric.c
+++ b/numeric.c
@@ -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
@@ -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);