End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Integer#to_f
int.to_f → float
numeric.c
View on GitHub ↗
static VALUE
int_to_f(VALUE num)
{
double val;
if (FIXNUM_P(num)) {
val = (double)FIX2LONG(num);
}
else if (RB_TYPE_P(num, T_BIGNUM)) {
val = rb_big2dbl(num);
}
else {
rb_raise(rb_eNotImpError, "Unknown subclass for to_f: %s", rb_obj_classname(num));
}
return DBL2NUM(val);
}