public override void SetString(string str) { TFrac TempFrac = new TFrac(str); Numerator = TempFrac.Numerator; Denominator = TempFrac.Denominator; }
public override object Square() { TFrac temp; temp = new TFrac((TNumber)Numerator.Square(), (TNumber)Denominator.Square()); return(temp); }
public override ANumber Sub(ANumber a) { TFrac temp; temp = new TFrac((a as TFrac).Numerator * Denominator - (a as TFrac).Denominator * Numerator, (a as TFrac).Denominator * Denominator); return(temp); }
public override ANumber Add(ANumber a) { TFrac temp; temp = new TFrac(Numerator * (a as TFrac).Denominator + Denominator * (a as TFrac).Numerator, Denominator * (a as TFrac).Denominator); return(temp); }
public static TFrac operator /(TFrac a, TFrac b) { TFrac temp; temp = new TFrac(a.Numerator * b.Denominator, a.Denominator * b.Numerator); return(temp); }
private string Number_to_state(string tag, string str) { if ("ERROR" == str) { return(str); } string return_str = str; switch (tag) { case TAG_PNUMBER: break; case TAG_FRAC: if (true == frac_mode) { return_str = str; } else if (new TFrac(str).Denominator == 1) { return_str = new TFrac(str).Numerator.ToString(); } break; case TAG_COMPLEX: if (true == complex_mode) { return_str = str; } else if (new TComplex(str).Imaginary == 0) { return_str = new TComplex(str).Real.ToString(); } break; } return(return_str); }
private string NumberBeatifier(string Tag, string str) { if (str == "ERROR") { return(str); } string ToReturn = str; switch (Tag) { case TAG_PNUMBER: break; case TAG_FRAC: if (FracMode == true) { ToReturn = str; } else if (new TFrac(str).Denominator == 1) { ToReturn = new TFrac(str).Numerator.ToString(); } break; case TAG_COMPLEX: if (ComplexMode == true) { ToReturn = str; } else if (new TComplex(str).Imaginary == 0) { ToReturn = new TComplex(str).Real.ToString(); } break; } return(ToReturn); }
public TFrac(TFrac anotherFrac) { Numerator = anotherFrac.Numerator; Denominator = anotherFrac.Denominator; }