From 5285acae3e5d020ea5f5fe144d122e9ebd0127de Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Sat, 23 Nov 2019 15:52:39 +0200 Subject: [PATCH] lib/decimal: calculate ln2/ln10 constant during compile time --- lib/decimal/decimal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/decimal/decimal.go b/lib/decimal/decimal.go index 73505bba3..2143a6393 100644 --- a/lib/decimal/decimal.go +++ b/lib/decimal/decimal.go @@ -358,7 +358,7 @@ func positiveFloatToDecimalSlow(f float64) (int64, int16) { prec = 1e15 } _, exp := math.Frexp(f) - scale = int16(float64(exp) * math.Ln2 / math.Ln10) + scale = int16(float64(exp) * (math.Ln2 / math.Ln10)) f *= math.Pow10(-int(scale)) }