summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-10 14:30:34 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-10 14:38:30 +0900
commitd69ffa4d93b12ddfb0d77f146921eb5d2fd62919 (patch)
tree42ced103cb83cac794b6e2c68b2639d2e6be5b77 /complex.c
parent98c22c78e40d84678e7bac187236e049e9d8c211 (diff)
Expanded f_quo
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)