Skip to content

Commit

Permalink
Decimal: fix error in bufSizeForFmt for formats p and b
Browse files Browse the repository at this point in the history
  • Loading branch information
db47h committed May 21, 2020
1 parent 33232a6 commit 942dbae
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions decimal_toa.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,11 @@ func (x *Decimal) bufSizeForFmt(fmt byte, prec int) int {
sz += prec
}
case 'b':
// -0.ddde±dd
sz += 2
fallthrough
case 'p':
// -ddddde±dd
sz += 1 + digits + 1 + expSz(x.exp)
sz += len(x.mant)*_DW + 1 + expSz(x.exp)
case 'p':
// -0.ddde±dd
sz += 2 + digits + 1 + expSz(x.exp)
default:
sz = prec
}
Expand Down

0 comments on commit 942dbae

Please sign in to comment.