Skip to content

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

instance method

Float#*

(::BigDecimal) -> ::BigDecimal
(::Complex) -> ::Complex
(::Numeric) -> ::Float
self * other → numeric

Returns a new Float which is the product of self and other:

Example
f = 3.14
f * 2              # => 6.28
f * 2.0            # => 6.28
f * Rational(1, 2) # => 1.57
f * Complex(2, 0)  # => (6.28+0.0i)
See also #% #** #+ also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0