minus

operator fun minus(subtrahend: BigDecimal): BigDecimal

Returns a BigDecimal whose value is (this - subtrahend), and whose _scale is max(this._scale(), subtrahend._scale()).

Return

this - subtrahend

Parameters

subtrahend

value to be subtracted from this BigDecimal.

fun minus(subtrahend: BigDecimal, mc: MathContext): BigDecimal

Returns a BigDecimal whose value is (this - subtrahend), with rounding according to the context settings.

If subtrahend is zero then this, rounded if necessary, is used as the result. If this is zero then the result is subtrahend.unaryMinus(mc).

Return

this - subtrahend, rounded as necessary.

Since

1.5

Parameters

subtrahend

value to be subtracted from this BigDecimal.

mc

the context to use.

Throws

if the result is inexact but the rounding mode is UNNECESSARY.