conversion from reals to rationals