diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-08-10 14:30:34 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-08-10 14:38:30 +0900 |
commit | d69ffa4d93b12ddfb0d77f146921eb5d2fd62919 (patch) | |
tree | 42ced103cb83cac794b6e2c68b2639d2e6be5b77 /complex.c | |
parent | 98c22c78e40d84678e7bac187236e049e9d8c211 (diff) |
Expanded f_quo
Diffstat (limited to 'complex.c')
-rw-r--r-- | complex.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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) |