title: How to compare rational numbers?
body: <p>This is a homework problem. Given class "Rational" with two integer fields, numerator and denominator, write a function to compare two "Rational" instances. Let <code>r1 = a/b</code> and <code>r2 = c/d</code>. The trivial solution is to compare <code>a*d</code> and <code>b*c</code>. Can we do better?</p>