Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns>a < b: - 1; a == b: 0; a > b: == 1</b></returns>
        public static int Compare(Rational a, Rational b)
        {
            Natural lcm = Natural.LCM(a.Denominator, b.Denominator);

            return(Integer.Compare(a.Numerator * lcm / a.Denominator, b.Numerator * lcm / a.Denominator));
        }