Finds the closest Rational to this Rational whose denominator is no
larger than limit.
Finds the closest Rational to this Rational whose denominator is no
larger than limit.
See http://en.wikipedia.org/wiki/Stern%E2%80%93Brocot_tree#Mediants_and_binary_search
Returns a Rational whose denominator and numerator are no larger than
max and whose value is close to the original.
Returns a Rational whose denominator and numerator are no larger than
max and whose value is close to the original. This applies, even if, for
example, this Rational is greater than max. In that case,
Rational(max, 1) is returned.
A positive integer.
Returns a Rational whose numerator and denominator both fit in an Int.
Returns a Rational whose numerator and denominator both fit in a Long.