Abs sets d to |x| (the absolute value of x).
(d, x *Decimal)
| 182 | |
| 183 | // Abs sets d to |x| (the absolute value of x). |
| 184 | func (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. |
| 194 | func (c *Context) Neg(d, x *Decimal) (Condition, error) { |
no test coverage detected