numeric.c: the result of -5.div(2) should be -3 as CRuby does.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-04-05 19:05:38 +09:00
parent 6ed21ead21
commit 5bef8e4135
+1 -4
View File
@@ -166,10 +166,7 @@ int_idiv(mrb_state *mrb, mrb_value x)
mrb_int y;
mrb_get_args(mrb, "i", &y);
if (y == 0) {
mrb_int_zerodiv(mrb);
}
return mrb_int_value(mrb, mrb_integer(x) / y);
return mrb_int_value(mrb, mrb_div_int(mrb, mrb_integer(x), y));
}
static mrb_value