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

Method Abs

context.go:184–191  ·  view source on GitHub ↗

Abs sets d to |x| (the absolute value of x).

(d, x *Decimal)

Source from the content-addressed store, hash-verified

182
183// Abs sets d to |x| (the absolute value of x).
184func (c *Context) Abs(d, x *Decimal) (Condition, error) {
185 if c.shouldSetAsNaN(x, nil) {
186 return c.setAsNaN(d, x, nil)
187 }
188 d.Abs(x)
189 res := c.round(d, d)
190 return c.goError(res)
191}
192
193// Neg sets d to -x.
194func (c *Context) Neg(d, x *Decimal) (Condition, error) {

Callers 1

PowMethod · 0.45

Calls 4

shouldSetAsNaNMethod · 0.95
setAsNaNMethod · 0.95
roundMethod · 0.95
goErrorMethod · 0.95

Tested by

no test coverage detected