Known bug in Excel????

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
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
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)
 
Upvote 0
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)

Got it - so it is a bug, just not known. (KH - right to left - with exponents - IS the correct order of precedence.)

Gene Klein
 
Upvote 0
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.
 
Upvote 0
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.

The bug that you pointed out is a known one. I'm not sure what your point is in your first paragraph. You say " Imagine what would happen if ALL of the programming languages used the correct order of precedence?" as if that were BAD thing. Excel is a calculator - an advanced one to be sure - but a calculator all the same. I certainly assume it was designed to due calculations following the order of operations. 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.

No matter - like I said, I have my answer.

Gene Klein
 
Upvote 0
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

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
 
Upvote 0
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.

In that example, Excel is NOT doing it's calculations Right To Left...
Instead, it is doing Multipliction Before Addition..

The same result would occur if it was writtin:
=4x2+3

Multiplication and Devision come before addition and subtraction..
 
Upvote 0
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

No you dont - the google calculator shows you that it has translated your expression to 2^(3^2) and then gives you the answer to that.
Excel gives you the same answer to 2^(3^2)
My pocket calculator gives the answer 64 when I enter 2 power button 3 power button 2

I would be interested to know what is the source of your theory about the correct way of doing this. Is your theory saying that the notation 2 superscript 3 supersuperscript 2 must always convert to a programming language statement 2 ^ 3 ^2, but that this should always be evaluated as 2^(3^2)?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top