numeric.c (mrb_float_to_integer): isinf/isnan takes any float values.

So don't need to cast to `float`, just use `mrb_float`.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-10-03 14:23:09 +09:00
parent 62e0e3eebe
commit 268f6dcab3
+1 -1
View File
@@ -1766,7 +1766,7 @@ mrb_float_to_integer(mrb_state *mrb, mrb_value x)
if (!mrb_float_p(x)) {
mrb_raise(mrb, E_TYPE_ERROR, "non float value");
}
float f = mrb_float(x);
mrb_float f = mrb_float(x);
if (isinf(f) || isnan(f)) {
mrb_raisef(mrb, E_RANGE_ERROR, "float %f out of range", f);
}