MCPcopy
hub / github.com/shopspring/decimal / Sub

Method Sub

decimal.go:537–545  ·  view source on GitHub ↗

Sub returns d - d2.

(d2 Decimal)

Source from the content-addressed store, hash-verified

535
536// Sub returns d - d2.
537func (d Decimal) Sub(d2 Decimal) Decimal {
538 rd, rd2 := RescalePair(d, d2)
539
540 d3Value := new(big.Int).Sub(rd.value, rd2.value)
541 return Decimal{
542 value: d3Value,
543 exp: rd.exp,
544 }
545}
546
547// Neg returns -d.
548func (d Decimal) Neg() Decimal {

Callers 15

LnMethod · 0.95
RoundBankMethod · 0.95
satanMethod · 0.95
SinMethod · 0.95
CosMethod · 0.95
TanMethod · 0.95
TestDecimal_SubFunction · 0.80
TestDecimal_DivRoundFunction · 0.80
TestDecimal_DivRound2Function · 0.80
DivRoundMethod · 0.80

Calls 1

RescalePairFunction · 0.85

Tested by 5

TestDecimal_SubFunction · 0.64
TestDecimal_DivRoundFunction · 0.64
TestDecimal_DivRound2Function · 0.64