public Measure Divide(DerivedMeasure d) { if (d == this) { return(new BaseMeasure()); } var a = new MeasureTerms(); foreach (var e in Terms) { var c = new MeasureTerm { Measure = e.Measure, Power = e.Power }; a.Add(c); } foreach (var e in d.Terms) { var c = new MeasureTerm { Measure = e.Measure, Power = e.Power }; c.Power = -c.Power; a.Add(c); } a.RemoveAll(x => x.Power == 0); return(new DerivedMeasure(a)); }
public Measure Divide(DerivedMeasure d) { if (d == this) { return(Empty); } var a = new MeasureTerms(); foreach (var e in Terms) { var c = Clone(e); a.Add(c); } foreach (var e in d.Terms) { var c = Clone(e); c.Power = -c.Power; a.Add(c); } a.RemoveAll(x => x.Power == 0); return(new DerivedMeasure(a)); }