Fix edge case.

Math.floor(x) is not the same as Math.ceil(x - 1) when x is an integer.