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; }
public Rational divide(Rational b) { Rational rv = new Rational(b); rv.flip(); rv.mulEq(this); return rv; }