summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/complex.c b/complex.c
index c357c99ea5..8c7f007b44 100644
--- a/complex.c
+++ b/complex.c
@@ -131,6 +131,17 @@ f_mul(VALUE x, VALUE y)
return ZERO;
if (x == ONE) return y;
if (y == ONE) return x;
+ return rb_int_mul(x, y);
+ }
+ else if (RB_FLOAT_TYPE_P(x) &&
+ UNLIKELY(rb_method_basic_definition_p(rb_cFloat, idMULT))) {
+ if (y == ONE) return x;
+ return rb_float_mul(x, y);
+ }
+ else if (RB_TYPE_P(x, T_RATIONAL) &&
+ UNLIKELY(rb_method_basic_definition_p(rb_cRational, idMULT))) {
+ if (y == ONE) return x;
+ return rb_rational_mul(x, y);
}
else if (UNLIKELY(rb_method_basic_definition_p(CLASS_OF(x), idMULT))) {
if (y == ONE) return x;