예제 #1
0
 public static Rational FromInts(int num, int den)
 {
     return(FromBignums(BigNum.FromInt(num), BigNum.FromInt(den)));
 }
예제 #2
0
        //    int numerator;
        //    int denominator;


        // invariant: 0 < denominator || (numerator == 0 && denominator == 0);
        // invariant: numerator != 0 ==> gcd(abs(numerator),denominator) == 1;
        // invariant: numerator == 0 ==> denominator == 1 || denominator == 0;

        public static Rational FromInt(int x)
        {
            return(FromBignum(BigNum.FromInt(x)));
        }