numeric.c (flo_idiv): add mrb_check_num_exact

This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-05-30 08:54:44 +09:00
parent 795044f82c
commit 6eedf1065d
+3 -1
View File
@@ -290,8 +290,10 @@ flo_pow(mrb_state *mrb, mrb_value x)
static mrb_value
flo_idiv(mrb_state *mrb, mrb_value xv)
{
mrb_float x = mrb_float(xv);
mrb_check_num_exact(mrb, x);
mrb_int y = mrb_as_int(mrb, mrb_get_arg1(mrb));
return mrb_div_int_value(mrb, (mrb_int)mrb_float(xv), y);
return mrb_div_int_value(mrb, (mrb_int)x, y);
}
mrb_float