Sign returns, if d is Finite: -1 if d < 0 0 if d == 0 or -0 +1 if d > 0 Otherwise (if d is Infinite or NaN): -1 if d.Negative == true +1 if d.Negative == false
()
| 606 | // -1 if d.Negative == true |
| 607 | // +1 if d.Negative == false |
| 608 | func (d *Decimal) Sign() int { |
| 609 | if d.Form == Finite && d.Coeff.Sign() == 0 { |
| 610 | return 0 |
| 611 | } |
| 612 | if d.Negative { |
| 613 | return -1 |
| 614 | } |
| 615 | return 1 |
| 616 | } |
| 617 | |
| 618 | // IsZero returns true if d == 0 or -0. |
| 619 | func (d *Decimal) IsZero() bool { |