From d69ffa4d93b12ddfb0d77f146921eb5d2fd62919 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 10 Aug 2019 14:30:34 +0900 Subject: Expanded f_quo --- complex.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'complex.c') 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) -- cgit v1.2.3