diff --git a/pkg/fixedpoint/dec.go b/pkg/fixedpoint/dec.go index e9cb02e10..1e13e5db5 100644 --- a/pkg/fixedpoint/dec.go +++ b/pkg/fixedpoint/dec.go @@ -793,6 +793,9 @@ func (dn Value) Int64() int64 { if 0 < dn.exp && dn.exp < digitsMax && (dn.coef%pow10[digitsMax-dn.exp]) == 0 { // usual case return int64(dn.sign) * int64(dn.coef/pow10[digitsMax-dn.exp]) + } else if dn.exp <= 0 && dn.coef != 0 { + result := math.Log10(float64(dn.coef)) - float64(digitsMax) + float64(dn.exp) + return int64(dn.sign) * int64(math.Pow(10, result)) } if dn.exp == digitsMax { return int64(dn.sign) * int64(dn.coef)