/** Set this ratio to this - r */ public void sub(Rational r) { n = n * r.getD() - r.getN() * d; d = d * r.getD(); // simplify now to avoid overflow problems _simplified = false; simplify(); // Must recalculate the double value. _gotDoubleValue = false; }
/** Set the value of this IntRatio to the given Ratioanal. */ public void set(Rational r) { n = r.getN(); d = r.getD(); // Must recalculate the double value. _gotDoubleValue = false; // No need to simplify until necessary. _simplified = false; }
/** Creates new IntRatio from the given Rational. */ public IntRatio(Rational r) { n = r.getN(); d = r.getD(); }