From 584bc5502b988253a319652f34079b3b8b4117c1 Mon Sep 17 00:00:00 2001 From: Dean Eigenmann <7621705+decanus@users.noreply.github.com> Date: Mon, 25 Sep 2023 17:23:17 +0200 Subject: [PATCH] optimize conversion --- decimal.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/decimal.go b/decimal.go index c614ea7..e7d47a8 100644 --- a/decimal.go +++ b/decimal.go @@ -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.