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)); }
public static bool IsSimplified(Fraction fraction) { return(IntegerMath.GreatestCommonDivisor(fraction.Numerator, fraction.Denominator) == 1); }