Discussion in 'Share Your Creations' started by coldraymagic, Jan 21, 2009.
A sample for arithmetical expression evaluation.(the sample supported function)
i think the bills are not right.
I agree with Filippo, unfortunately your math evaluator doesn't take into account the order of operations Order of operations - Wikipedia, the free encyclopedia !
In Filippo's examples:
sqrt(9) + 2 ^ 2 = 3 + 4 = 7 and not 25
the sqrt operation AND the ^ operation must be executed before the + operation !
your calculation is equivalent to
(sqrt(9) + 2) ^ 2 = 25
You may revise your code according to 'order of operations' and come up with solution rather than mine here-> http://www.basic4ppc.com/forum/code...tific-math-text-input-evaluator.html#post6290 or perhaps debug, further investigate and optimized my code.
Hi Klaus,(typo) it is 7 not 9
Thank's for the 'bug report', I corrected the value in my post.
It seems that I was more concentated on the principle rather than on the result? But anyway this one must be correct !