Example #1
0
            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());
            }
Example #2
0
            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());
            }
Example #3
0
            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());
            }
Example #4
0
            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());
            }