/// <summary> /// 減算 /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public static Fraction operator -(Fraction x, Fraction y) { //両分母の最小公倍数をとる int lc = NumericOperation.LCM(x.denominator, y.denominator); //分母が異なるなら最小公倍数/分母を分子にかける if (x.denominator != y.denominator) { x.numerator *= (lc / x.denominator); y.numerator *= (lc / y.denominator); } Fraction result = new Fraction(x.numerator - y.numerator, lc); return(result); }