public override INumber Eval(RuntimeData runtime) { AdditionFormula af = new Expression.AdditionFormula(); for (int i = 0; i < this.items.Count; i++) { var res = this.items[i].Eval(runtime); bool flag = false; for (int j = 0; j < af.Count; j++) { if (res.CanJoin(runtime, af.items[j])) { var itm = af.items[j]; af.items.RemoveAt(j); af.AddItem(runtime, itm.Add(runtime, res)); flag = true; break; } } if (!flag) { af.AddItem(runtime, res); } } INumber result = null; if (af.items.Count == 1) { result = af.items[0]; } else { result = af; } result = result.Power(runtime, this.Pow); return(result); }
public INumber Execute(RuntimeData runtime, INumber left, INumber right) { return(left.Power(runtime, right)); }