Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Float#quo

(::Complex) -> ::Complex
(::Numeric) -> ::Float
quo(other) → numeric

Returns the quotient from dividing self by other:

Example
f = 3.14
f.quo(2)              # => 1.57
f.quo(-2)             # => -1.57
f.quo(Rational(2, 1)) # => 1.57
f.quo(Complex(2, 0))  # => (1.57+0.0i)
See also #prev_float #rationalize #positive? #round also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0