Use Math.floor instead of parseInt to avoid problems with very small numbers like 2e-10