Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Rational#fdiv

rat.fdiv(numeric) → float

Performs division and returns the value as a Float.

Example
Rational(2, 3).fdiv(1)       #=> 0.6666666666666666
Rational(2, 3).fdiv(0.5)     #=> 1.3333333333333333
Rational(2).fdiv(3)          #=> 0.6666666666666666
See also #denominator #floor #ceil #hash also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0