mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-22 04:20:50 +01:00
optimize conversion
This commit is contained in:
parent
f55dd56454
commit
584bc5502b
1 changed files with 1 additions and 4 deletions
|
@ -967,10 +967,7 @@ func (d Decimal) IntPart() int64 {
|
|||
|
||||
// BigInt returns integer component of the decimal as a BigInt.
|
||||
func (d Decimal) BigInt() *big.Int {
|
||||
scaledD := d.rescale(0)
|
||||
i := &big.Int{}
|
||||
i.SetString(scaledD.String(), 10)
|
||||
return i
|
||||
return new(big.Int).Set(d.value)
|
||||
}
|
||||
|
||||
// BigFloat returns decimal as BigFloat.
|
||||
|
|
Loading…
Reference in a new issue