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

Commit

Permalink
Ability to create from bigint
Browse files Browse the repository at this point in the history
  • Loading branch information
gee-m authored Mar 30, 2018
1 parent 4142ddf commit 43c63aa
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 43c63aa

Please sign in to comment.