protected override string Perform(string equation) { Match expr = EquationPattern.Match(equation); Decimal left = ParseDecimal(expr.Groups["left"].Value); Decimal right = ParseDecimal(expr.Groups["right"].Value); return(String.Concat(System.Math.Floor(left / right), ",", (left % right)).ToString()); }
protected override string Perform(string equation) { Match expr = EquationPattern.Match(equation); Decimal left = ParseDecimal(expr.Groups["left"].Value); Decimal right = ParseDecimal(expr.Groups["right"].Value); return(System.Math.Pow((double)left, (double)right).ToString()); }
protected override string Perform(string equation) { Match expr = EquationPattern.Match(equation); Decimal left = ParseDecimal(expr.Groups["left"].Value); Decimal right = ParseDecimal(expr.Groups["right"].Value); return((left % right).ToString()); }
protected override string Perform(string equation) { Match expr = EquationPattern.Match(equation); Decimal left = ParseDecimal(expr.Groups["left"].Value); Decimal right = ParseDecimal(expr.Groups["right"].Value); string oper = expr.Groups["oper"].Value; if (oper.Contains("*")) { return((left * right).ToString()); } return((left / right).ToString()); }