Skip to content

Commit

Permalink
Merge pull request #144 from forsaken628/patch-1
Browse files Browse the repository at this point in the history
fix: Coefficient panic
  • Loading branch information
njason authored Oct 9, 2019
2 parents a36b5d8 + 62587fc commit 2677b5d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ func (d Decimal) Exponent() int32 {

// Coefficient returns the coefficient of the decimal. It is scaled by 10^Exponent()
func (d Decimal) Coefficient() *big.Int {
d.ensureInitialized()
// we copy the coefficient so that mutating the result does not mutate the
// Decimal.
return big.NewInt(0).Set(d.value)
Expand Down

0 comments on commit 2677b5d

Please sign in to comment.