Fix regression and overflow bug for rationals.

When I fixed the previous issue with rational rounding, I had introduced a regression. There was also an overflow bug introduced for fixed-precision rationals. This patch corrects both bugs.
Just a preference against nested if statements. Your logic is clearer.