Ejemplo n.º 1
0
 public static RatNum make(IntNum num, IntNum den)
 {
     IntNum g = IntNum.gcd (num, den);
     if (den.isNegative ())
         g = IntNum.neg (g);
     if (! g.isOne ())
         {
             num = IntNum.quotient (num, g);
             den = IntNum.quotient (den, g);
         }
     return den.isOne () ? (RatNum)num : (RatNum)(new IntFraction (num, den));
 }