Sub returns d - d2.
(d2 Decimal)
| 535 | |
| 536 | // Sub returns d - d2. |
| 537 | func (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. |
| 548 | func (d Decimal) Neg() Decimal { |