mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-22 20:40:48 +01:00
Merge pull request #144 from forsaken628/patch-1
fix: Coefficient panic
This commit is contained in:
commit
2677b5dba8
1 changed files with 1 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue