End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Float#/
float / other → float
numeric.c
View on GitHub ↗
VALUE
rb_float_div(VALUE x, VALUE y)
{
double num = RFLOAT_VALUE(x);
double den;
double ret;
if (RB_TYPE_P(y, T_FIXNUM)) {
den = FIX2LONG(y);
}
else if (RB_TYPE_P(y, T_BIGNUM)) {
den = rb_big2dbl(y);
}
else if (RB_TYPE_P(y, T_FLOAT)) {
den = RFLOAT_VALUE(y);
}
else {
return rb_num_coerce_bin(x, y, '/');
}
ret = double_div_double(num, den);
return DBL2NUM(ret);
}
Returns a new Float which is the result of dividing float by other.