Exemplo n.º 1
0
        public static Fraction Simplify(Fraction fraction)
        {
            fraction = Normalize(fraction);

            long num = fraction.Numerator;
            long den = fraction.Denominator;

            long g = IntegerMath.GreatestCommonDivisor(num, den);

            num /= g;
            den /= g;

            return(new Fraction(num, den));
        }
Exemplo n.º 2
0
 public static bool IsSimplified(Fraction fraction)
 {
     return(IntegerMath.GreatestCommonDivisor(fraction.Numerator, fraction.Denominator) == 1);
 }