diff options
author | yenlin.lai <yenlin.lai@cobinhood.com> | 2019-04-25 09:15:06 +0800 |
---|---|---|
committer | Jhih-Ming Huang <jm.huang@cobinhood.com> | 2019-05-06 10:44:05 +0800 |
commit | 4a93916c7450ae197376e65500fef4fab11bf220 (patch) | |
tree | 10c0b43c4b07f656e6b857045370f15b0768d89f /vendor | |
parent | a07ab648532edfadba1e4b616784dbae5cb3a742 (diff) | |
download | dexon-4a93916c7450ae197376e65500fef4fab11bf220.tar dexon-4a93916c7450ae197376e65500fef4fab11bf220.tar.gz dexon-4a93916c7450ae197376e65500fef4fab11bf220.tar.bz2 dexon-4a93916c7450ae197376e65500fef4fab11bf220.tar.lz dexon-4a93916c7450ae197376e65500fef4fab11bf220.tar.xz dexon-4a93916c7450ae197376e65500fef4fab11bf220.tar.zst dexon-4a93916c7450ae197376e65500fef4fab11bf220.zip |
misc: update decimal
Update dexon-foundation/decimal for new performance tuning commit.
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/dexon-foundation/decimal/decimal.go | 7 | ||||
-rw-r--r-- | vendor/vendor.json | 6 |
2 files changed, 7 insertions, 6 deletions
diff --git a/vendor/github.com/dexon-foundation/decimal/decimal.go b/vendor/github.com/dexon-foundation/decimal/decimal.go index 0f5079c42..ca277cf04 100644 --- a/vendor/github.com/dexon-foundation/decimal/decimal.go +++ b/vendor/github.com/dexon-foundation/decimal/decimal.go @@ -386,14 +386,15 @@ func (d Decimal) Rescale(exp int32) Decimal { // func (d Decimal) rescale(exp int32) Decimal { d.ensureInitialized() - // NOTE(vadim): must convert exps to float64 before - to prevent overflow - diff := math.Abs(float64(exp) - float64(d.exp)) + // NOTE: convert exps to int64 before - to prevent overflow + diff := int64(exp) - int64(d.exp) value := new(big.Int).Set(d.value) - expScale := new(big.Int).Exp(tenInt, big.NewInt(int64(diff)), nil) if exp > d.exp { + expScale := new(big.Int).Exp(tenInt, big.NewInt(diff), nil) value = value.Quo(value, expScale) } else if exp < d.exp { + expScale := new(big.Int).Exp(tenInt, big.NewInt(-diff), nil) value = value.Mul(value, expScale) } diff --git a/vendor/vendor.json b/vendor/vendor.json index afb9bac6c..ee8952501 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -139,10 +139,10 @@ "versionExact": "dev" }, { - "checksumSHA1": "7puYGOPhizIgr5nZ6GcRPNfr4Dc=", + "checksumSHA1": "YyJHUZ/uQM+qwymBCH1fhLTQtds=", "path": "github.com/dexon-foundation/decimal", - "revision": "05ad7315b3c581519964b7762074e00de3c4ceac", - "revisionTime": "2019-03-25T09:02:55Z" + "revision": "f9f60f8590bfa9da46f7c607089a3d36c54e2043", + "revisionTime": "2019-04-17T09:32:26Z" }, { "checksumSHA1": "In6vBHYUsX7DUIGiFN2hQggBgvI=", |