fix roundoff error in grid division