Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

BigDecimal#-

self - value → bigdecimal

Returns the BigDecimal difference of self and value:

Example
b = BigDecimal('333333.333') # => 0.333333333e6
b - 2                        # => 0.333331333e6
b - 2.0                      # => 0.333331333e6
b - Rational(2, 1)           # => 0.333331333e6
b - Complex(2, 0)            # => (0.333331333e6+0i)

See the Note About Precision.

See also #+@ #-@ #+ #/ also in 3.3 · 3.2 · 3.0