fixed floating-point rounding error bug