Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
update apd
Browse files Browse the repository at this point in the history
  • Loading branch information
maddyblue committed Aug 6, 2018
1 parent 8ac6cac commit d5cea79
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion github.com/cockroachdb/apd/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- 1.8.x
- 1.9.x
- 1.10.x

script: go test
7 changes: 1 addition & 6 deletions github.com/cockroachdb/apd/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,7 @@ func (c *Context) Neg(d, x *Decimal) (Condition, error) {
if set, res, err := c.setIfNaN(d, x); set {
return res, err
}
if x.IsZero() {
d.Set(x)
d.Negative = false
} else {
d.Neg(x)
}
d.Neg(x)
return c.Round(d, d)
}

Expand Down
6 changes: 5 additions & 1 deletion github.com/cockroachdb/apd/decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,11 @@ func (d *Decimal) Modf(integ, frac *Decimal) {
// Neg sets d to -x and returns d.
func (d *Decimal) Neg(x *Decimal) *Decimal {
d.Set(x)
d.Negative = !d.Negative
if d.IsZero() {
d.Negative = false
} else {
d.Negative = !d.Negative
}
return d
}

Expand Down

0 comments on commit d5cea79

Please sign in to comment.