示例#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)));
        }