Esempio n. 1
0
        public static Fraction operator +(Fraction a, Fraction b)
        {
            long gcd          = Fun.GreatestCommonDivisor(a.Denominator, b.Denominator);
            long aDenomDivGcd = a.Denominator / gcd;

            return(new Fraction(
                       a.Numerator * (b.Denominator / gcd)
                       + b.Numerator * aDenomDivGcd,
                       aDenomDivGcd * b.Denominator
                       ));
        }