Ejemplo n.º 1
0
 public Rational reciprocate() {
   if (zero(num)) throw new ArithmeticException("Divide by zero");
   Rational rv = new Rational(this);
   rv.flip();
   if (negative(den)) {
     rv.num = rv.num.negate();
     rv.den = rv.den.negate();
   }
   return rv;
 }