Better length rounding

Using the old rounding algorithm, the number sometimes ended up as NaN. Now this is not the case.