Exemplo n.º 1
0
        private static double SolveEquation(List <string> equationList)
        {
            MathInterpreter mathInterpreter = new MathInterpreter();
            double          solution        = mathInterpreter.Solve(equationList);

            if (mathInterpreter.ErrorOccurred)
            {
                ThrowException(12);
            }

            return(solution);
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static Primitive SolveMath(Primitive str)
        {
            MathInterpreter m      = new MathInterpreter();
            double          output = m.Solve(new List <string>(str.ToString().Split(' ')));

            if (m.ErrorOccurred)
            {
                throw new FormatException("De opgegeven string is niet op te lossen.");
            }

            return(output);
        }