Skip to content

Commit

Permalink
golint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maddyblue committed Jun 30, 2017
1 parent 6d74f97 commit 738b799
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
16 changes: 8 additions & 8 deletions condition.go
Expand Up @@ -152,15 +152,15 @@ func (r Condition) String() string {

// negateOverflowFlags converts Overflow and SystemOverflow flags into their
// equivalent Underflows.
func (c Condition) negateOverflowFlags() Condition {
if c.Overflow() {
func (r Condition) negateOverflowFlags() Condition {
if r.Overflow() {
// Underflow always also means Subnormal. See GDA definition.
c |= Underflow | Subnormal
c &= ^Overflow
r |= Underflow | Subnormal
r &= ^Overflow
}
if c.SystemOverflow() {
c |= SystemUnderflow
c &= ^SystemOverflow
if r.SystemOverflow() {
r |= SystemUnderflow
r &= ^SystemOverflow
}
return c
return r
}
6 changes: 3 additions & 3 deletions context.go
Expand Up @@ -984,11 +984,11 @@ func (c *Context) Exp(d, x *Decimal) (Condition, error) {
if err != nil {
return 0, errors.Wrap(err, "ki")
}
if ires, err := nc.integerPower(d, sum, ki); err != nil {
ires, err := nc.integerPower(d, sum, ki)
if err != nil {
return 0, errors.Wrap(err, "integer power")
} else {
res |= ires
}
res |= ires
nc.Precision = c.Precision
res |= nc.round(d, d)
return c.goError(res)
Expand Down
11 changes: 7 additions & 4 deletions decimal.go
Expand Up @@ -38,17 +38,21 @@ type Decimal struct {
Coeff big.Int
}

// Form specifies the form of a Decimal.
type Form int

const (
// These constants must be in the following order. CmpTotal assumes that
// the order of these constants reflects the total order on decimals.

// Finite is the finite form.
Finite Form = iota
// Infinite is the infinite form.
Infinite
// NaNSignaling will always raise the InvalidOperation condition during
// an operation.
// NaNSignaling is the signaling NaN form. It will always raise the
// InvalidOperation condition during an operation.
NaNSignaling
// NaN is the NaN form.
NaN
)

Expand Down Expand Up @@ -600,9 +604,8 @@ func (d *Decimal) Cmp(x *Decimal) int {
if d.Form == Infinite {
if x.Form == Infinite {
return 0
} else {
return gt
}
return gt
} else if x.Form == Infinite {
return lt
}
Expand Down
3 changes: 2 additions & 1 deletion doc.go
Expand Up @@ -12,7 +12,8 @@
// implied. See the License for the specific language governing
// permissions and limitations under the License.

/* Package apd implements arbitrary-precision decimals.
/*
Package apd implements arbitrary-precision decimals.
apd implements much of the decimal specification from the General
Decimal Arithmetic (http://speleotrove.com/decimal/) description. This
Expand Down

0 comments on commit 738b799

Please sign in to comment.