aboutsummaryrefslogtreecommitdiffstats
path: root/complex.c
diff options
context:
space:
mode:
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/complex.c b/complex.c
index ed35b2b2b5..ec60c00ed6 100644
--- a/complex.c
+++ b/complex.c
@@ -285,7 +285,19 @@ f_eqeq_p(VALUE x, VALUE y)
fun2(expt)
fun2(fdiv)
-fun2(quo)
+
+static VALUE
+f_quo(VALUE x, VALUE y)
+{
+ if (RB_INTEGER_TYPE_P(x))
+ return rb_numeric_quo(x, y);
+ if (RB_FLOAT_TYPE_P(x))
+ return rb_float_div(x, y);
+ if (RB_TYPE_P(x, T_RATIONAL))
+ return rb_numeric_quo(x, y);
+
+ return rb_funcallv(x, id_quo, 1, &y);
+}
inline static int
f_negative_p(VALUE x)