Fix rounding when converting to fixed precision

This commit is contained in:
Michael Fogleman 2021-09-28 10:35:13 -04:00
parent af4cd58078
commit 8febc0f526

View File

@ -109,7 +109,7 @@ func fixp(x, y float64) fixed.Point26_6 {
} }
func fix(x float64) fixed.Int26_6 { func fix(x float64) fixed.Int26_6 {
return fixed.Int26_6(x * 64) return fixed.Int26_6(math.Round(x * 64))
} }
func unfix(x fixed.Int26_6) float64 { func unfix(x fixed.Int26_6) float64 {