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

Commit

Permalink
Merge pull request #1 from processout/add-from-bigint
Browse files Browse the repository at this point in the history
Ability to create from bigint
  • Loading branch information
gee-m authored Mar 30, 2018
2 parents 4142ddf + 43c63aa commit 347c367
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 @@ -80,6 +80,14 @@ func New(value int64, exp int32) Decimal {
}
}

// NewFromBigInt returns a new Decimal from a big.Int, value * 10 ^ exp
func NewFromBigInt(value *big.Int, exp int32) Decimal {
return Decimal{
value: big.NewInt(0).Set(value),
exp: exp,
}
}

// NewFromString returns a new Decimal from a string representation.
//
// Example:
Expand Down

0 comments on commit 347c367

Please sign in to comment.