Skip to content

Commit

Permalink
Fix misspellings and some golint woes
Browse files Browse the repository at this point in the history
  • Loading branch information
db47h committed Jun 13, 2020
1 parent 305608a commit 44c0ea9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ func (z *Decimal) SetFloat(x *big.Float) *Decimal {
exp2 -= int64(fprec)
if exp2 != 0 {
// multiply / divide by 2**exp with increased precision
z.prec += 1
z.prec++
t := new(Decimal).SetPrec(uint(z.prec))
if exp2 < 0 {
if exp2 < MinExp {
Expand All @@ -1056,7 +1056,7 @@ func (z *Decimal) SetFloat(x *big.Float) *Decimal {
} else {
z = z.Mul(z, t.pow2(uint64(exp2)))
}
z.prec -= 1
z.prec--
}
z.round(0)
return z
Expand Down Expand Up @@ -1097,14 +1097,14 @@ func (z *Decimal) SetFloat64(x float64) *Decimal {
z.exp = int32(len(z.mant))*_DW - int32(dnorm(z.mant))
if exp2 != 0 {
// multiply / divide by 2**exp with increased precision
z.prec += 1
z.prec++
t := new(Decimal).SetPrec(uint(z.prec))
if exp2 < 0 {
z = z.Quo(z, t.pow2(uint64(-exp2)))
} else {
z = z.Mul(z, t.pow2(uint64(exp2)))
}
z.prec -= 1
z.prec--
}
z.round(0)
return z
Expand Down Expand Up @@ -1617,8 +1617,10 @@ func (z *Decimal) umul(x, y *Decimal) {
}

const (
DigitsPerWord = _DW // number of decimal digits per 32 or 64 bits mantissa Word
DecimalBase = _DB // decimal base
// DigitsPerWord is the number of decimal digits per 32 or 64 bits mantissa Word.
DigitsPerWord = _DW
// DecimalBase is the decimal base for a 32 or 64 bits mantissa Word.
DecimalBase = _DB
)

// BitsExp provides raw (unchecked but fast) access to x by returning its
Expand Down
6 changes: 3 additions & 3 deletions decimal_toa.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
//
// Note that the 'b' and 'p' formats differ from big.Float: an hexadecimal
// representation does not make sense for decimals. These formats use a full
// decimal representaion instead.
// decimal representation instead.
//
// If format is a different character, Text returns a "%" followed by the
// unrecognized format character.
Expand Down Expand Up @@ -179,7 +179,7 @@ func (x *Decimal) bufSizeForFmt(fmt byte, prec int) int {
sz += prec + 1
}
case 'f':
sz += 1
sz++
if prec < 0 {
sz += digits
if exp < 0 || exp > digits {
Expand Down Expand Up @@ -438,7 +438,7 @@ func (x *Decimal) Format(s fmt.State, format rune) {
}

// toa returns x.mant.utoa(base) and x.exp with least significant zero Words removed
// this function retuns nil, 0 for non-finite numbers.
// this function returns nil, 0 for non-finite numbers.
func (x *Decimal) toa(base int) ([]byte, int) {
if x.form == finite {
m := x.mant
Expand Down

0 comments on commit 44c0ea9

Please sign in to comment.