diff --git a/decimal.go b/decimal.go index 134ece2..a29ea1a 100644 --- a/decimal.go +++ b/decimal.go @@ -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)