Пример #1
0
        CalculatorModel(string expression)
        {
            this.expression = expression;
            db = new DBContext();

            operations = new Dictionary <string, Func <double, double, double> >
            {
                { "+", (x, y) => x + y },
                { "-", (x, y) => x - y },
                { "*", (x, y) => x * y },
                { "/", (x, y) => x / y },
                { "mod", (x, y) => x % y },
                { "pow", (x, y) => Math.Pow(x, y) },
                { "sqrt", (x, y) => y != 0 ? Math.Pow(x, 1 / y): 1 / y }
            };


            db.AddExpression("127.0.0.1", expression);
        }