optimize conversion

This commit is contained in:
Dean Eigenmann 2023-09-25 17:23:17 +02:00 committed by GitHub
parent f55dd56454
commit 584bc5502b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -967,10 +967,7 @@ func (d Decimal) IntPart() int64 {
// BigInt returns integer component of the decimal as a BigInt. // BigInt returns integer component of the decimal as a BigInt.
func (d Decimal) BigInt() *big.Int { func (d Decimal) BigInt() *big.Int {
scaledD := d.rescale(0) return new(big.Int).Set(d.value)
i := &big.Int{}
i.SetString(scaledD.String(), 10)
return i
} }
// BigFloat returns decimal as BigFloat. // BigFloat returns decimal as BigFloat.