lib/decimal: calculate ln2/ln10 constant during compile time

This commit is contained in:
Aliaksandr Valialkin 2019-11-23 15:52:39 +02:00
parent 8582b50360
commit 5285acae3e

View file

@ -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))
}