Skip to content

Commit 8febc0f

Browse files
committed
Fix rounding when converting to fixed precision
1 parent af4cd58 commit 8febc0f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func fixp(x, y float64) fixed.Point26_6 {
109109
}
110110

111111
func fix(x float64) fixed.Int26_6 {
112-
return fixed.Int26_6(x * 64)
112+
return fixed.Int26_6(math.Round(x * 64))
113113
}
114114

115115
func unfix(x fixed.Int26_6) float64 {

0 commit comments

Comments
 (0)