replace floor hack with Math.floor()

Rounding a `value - 0.5` is a common hack to work around the lack of a floor function. Since Math.floor() exists, this can be replaced.

I just noticed this while reading the code to look into a different issue.