Example #1
0
        /** 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;
        }
Example #2
0
        /** 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;
        }
Example #3
0
 /** Creates new IntRatio from the given Rational.
  */
 public IntRatio(Rational r)
 {
     n = r.getN();
     d = r.getD();
 }
Example #4
0
        /** 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;
        }
Example #5
0
        /** 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;
        }
Example #6
0
 /** Creates new IntRatio from the given Rational.
  */
 public IntRatio(Rational r)
 {
     n = r.getN();
     d = r.getD();
 }