Skip to content

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

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
See also #even? #floor #downto #gcd also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1