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

Method Neg

decimal.go:687–695  ·  view source on GitHub ↗

Neg sets d to -x and returns d.

(x *Decimal)

Source from the content-addressed store, hash-verified

685
686// Neg sets d to -x and returns d.
687func (d *Decimal) Neg(x *Decimal) *Decimal {
688 d.Set(x)
689 if d.IsZero() {
690 d.Negative = false
691 } else {
692 d.Negative = !d.Negative
693 }
694 return d
695}
696
697// Abs sets d to |x| and returns d.
698func (d *Decimal) Abs(x *Decimal) *Decimal {

Callers 2

TestNegFunction · 0.95
setBigMethod · 0.45

Calls 2

SetMethod · 0.95
IsZeroMethod · 0.95

Tested by 1

TestNegFunction · 0.76