Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. 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.2 · 3.1 · 3.0