Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
Update decimal.go
Browse files Browse the repository at this point in the history
  • Loading branch information
gee-m authored Mar 30, 2018
1 parent 347c367 commit c7d32d3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,14 @@ func (d Decimal) Exponent() int32 {
return d.exp
}

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


// IntPart returns the integer component of the decimal.
func (d Decimal) IntPart() int64 {
scaledD := d.rescale(0)
Expand Down

0 comments on commit c7d32d3

Please sign in to comment.