src/numeric.c: use `mrb_ensure_float_type()`.
Instead of obsolete `mrb_to_float()` or the combination of
`mrb_float_value(mrb_as_float())`.
MODIFY
mrbgems/mruby-kernel-ext/src/kernel.c
mrbgems/mruby-kernel-ext/src/kernel.c
@@ -191,7 +191,7 @@ mrb_f_float(mrb_state *mrb, mrb_value self)
if (mrb_string_p(arg)) {
return mrb_float_value(mrb, mrb_str_to_dbl(mrb, arg, TRUE));
}
- return mrb_to_float(mrb, arg);
+ return mrb_ensure_float_type(mrb, arg);
}
#endif

MODIFY
mrbgems/mruby-pack/src/pack.c
mrbgems/mruby-pack/src/pack.c
@@ -1395,8 +1395,7 @@ mrb_pack_pack(mrb_state *mrb, mrb_value ary)
#ifndef MRB_NO_FLOAT
else if (type == PACK_TYPE_FLOAT) {
if (!mrb_float_p(o)) {
- mrb_float f = mrb_as_float(mrb, o);
- o = mrb_float_value(mrb, f);
+ o = mrb_ensure_float_type(mrb, o);
}
}
#endif

MODIFY
src/numeric.c
src/numeric.c
@@ -259,7 +259,7 @@ coerce_step_counter(mrb_state *mrb, mrb_value self)
#ifndef MRB_NO_FLOAT
mrb->c->ci->mid = 0;
if (mrb_float_p(num) || mrb_float_p(step)) {
- return mrb_to_float(mrb, self);
+ return mrb_ensure_float_type(mrb, self);
}
#endif

src/numeric.c: use `mrb_ensure_float_type()`.

Instead of obsolete `mrb_to_float()` or the combination of
`mrb_float_value(mrb_as_float())`.