End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Integer#fdiv
int.fdiv(numeric) → float
numeric.c
View on GitHub ↗
VALUE
rb_int_fdiv(VALUE x, VALUE y)
{
if (RB_INTEGER_TYPE_P(x)) {
return DBL2NUM(rb_int_fdiv_double(x, y));
}
return Qnil;
}
Returns the floating point result of dividing int by numeric.
Example
654321.fdiv(13731) #=> 47.652829364212366 654321.fdiv(13731.24) #=> 47.65199646936475 -654321.fdiv(13731) #=> -47.652829364212366