Fix rounding when converting to fixed precision
This commit is contained in:
parent
af4cd58078
commit
8febc0f526
2
util.go
2
util.go
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user