Skip to content
instance method

Float#+

(::BigDecimal) -> ::BigDecimal
(::Complex) -> ::Complex
(::Numeric) -> ::Float
self + other → float or complex

Returns the sum of self and other; the result may be inexact (see Float):

Example
3.14 + 0              # => 3.14
3.14 + 1              # => 4.140000000000001
-3.14 + 0             # => -3.14
-3.14 + 1             # => -2.14

3.14 + -3.14          # => 0.0
-3.14 + -3.14         # => -6.28

3.14 + Complex(1, 0)   # => (4.140000000000001+0i)
3.14 + Rational(1, 1)  # => 4.140000000000001
See also #** #- #* #-@ also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0