mortgageman
Well-known Member
- Joined
- Jun 30, 2005
- Messages
- 2,015
According to math rules 2^3^2 should equal 2^9 (you go right to left in this case). Excel gives 64. Is this a known bug?
Gene Klein
Gene Klein
Excel calculates left to right.
Without any parentheses, with the same operand, with Excel calculating from left to right, so 2^3 = 8 ^ 2 = 64
To get the result you want:
=2^(3^2)
I would say that a bug is when it is not working as designed. Imagine what would happen if ALL of the programming languages used the correct order of precedence? You would have lots of work to do if you were the programmer. God forbid if you forgot to make the changes and a moon shot was missed...
I could not find your right to left rule in the few math books from my college days. I did find one showing the left to right rule for exponents but on the web but who knows how accurate that is. http://www.mathgoodies.com/lessons/vol7/operations_exponents.html
Here is another "bug" according to math rules. In Excel, -2^2=4, and not -4 as math rules would show.
In the end, now that you know the Excel rules as I pointed out, you can code accordingly.
I could not find your right to left rule in the few math books from my college days. I did find one showing the left to right rule for exponents but on the web but who knows how accurate that is. http://www.mathgoodies.com/lessons/vol7/operations_exponents.html
I assume you would be upset if Excel gave you 14 as the result of 3+4x2. (At least I hope you would be upset). I also think you would feel put upon if you always had to enter 3+(4x2) to get the correct result.
BTW - your link did not address my point. The right to left exception comes when you have a power to a power. If you type 2^3^2 in google you will get the correct answer of 512 and not the incorrect answer of 64
Gene Klein