Expression "2 * [x] ^ 2 + 5 * [y]" is not correctly

Dec 22, 2009 at 3:10 AM

            

           version 1.3.3 test code : 

            Expression e = new Expression("2 * [x] ^ 2 + 5 * [y]");
            e.Parameters["x"] = 5;
            e.Parameters["y"] = 1;

            Console.WriteLine(e.Evaluate());

            result = 13

            why? result = 55 is correctly!

 

Coordinator
Dec 22, 2009 at 5:52 AM

It might be cumbersome but the ^ operator is for bitwise xor. There is a Pow(x,y) function for powers.

Dec 22, 2009 at 6:43 AM

I see, thank you a lot!