MCPcopy Create free account
hub / github.com/cockroachdb/apd / Sign

Method Sign

decimal.go:608–616  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

606// -1 if d.Negative == true
607// +1 if d.Negative == false
608func (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.
619func (d *Decimal) IsZero() bool {

Callers 6

CeilMethod · 0.95
FloorMethod · 0.95
CmpMethod · 0.95
IsZeroMethod · 0.95
NewWithBigIntFunction · 0.45
ReduceMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected