Why is it that Microsoft Excel 7 says that 8^(-1^(-8^7))) = 8 while Wolfram Alpha says it equals 1/8?
These results are the same if I substitute -2097152.0 for -8^7.
Now -1 to any power is -1. Therefore -1^(-8^7) = -1. And 8^-1=1/8.
Excel is wrong.
Try it and see!
- 15
4 Answers
Excel and Wolfram Alpha have difference precedence rules for parsing an expression like this involving exponentiation and unary minus.
- x ^ y
Excel treats unary minus as higher precedence and does it first, evaluating the expression as:
( - x ) ^ y
Wolfram Alpha does the exponentiation first, evaluating the expression as:
- ( x ^ y )
- 10,023
-
1
-
Okay, but at least it follows the same precedence rules as C/C++. – Nicole Hamilton Aug 30 '16 at 08:54
The problem is that in Excel the minus sign is used to signify both the subtraction operator and the unary sign. It is easy to illustrate this. In A1 enter:
=-1^(ROW())
and copy down:
The flip/flopping positive/negative indicates that Excel sees the minus sign as a unary and treats this formula like:
=(-1)^(ROW())
Now in B1 enter:
=0-1^(-ROW())
and copy down:
The lack of flip/flopping indicates that Excel sees the minus sign as a subtraction operator and treats this formula like:
=0-(1^(-ROW()))
Of course, the user can always control the precedence by using parenthesis.
EDIT#1:
- 19,396
Wolfram Alpha does this:
-(1-2097152) = -(1) = -1
8-1 = 1/8
Excel, on the other hand, does this:
(-1)-2097152 = 1
81 = 8
Indeed, Excel is wrong - it should exponentiate first, then negate. Try this formula: =8^(-(1^(-8^7)))
Now -1 to any power is -1
As var firstName already pointed out, that's incorrect. However, it's true that -1N = -1 is true for any N - again, because you should exponentiate first, then negate.
-
No, actually, Excel is right. That method of entry is incorrect. OP meant 8^((-1)^((-8)^7)) – var firstName Aug 29 '16 at 22:26
-
@varfirstName Why would it be incorrect? Standard order of operations is: exponents and roots, then multiplication and division, then addition and subtraction. So basically the Wolfram Alpha order. Excel groups (-1) first (basically
0 - 1subtraction), then exponentiates - that's incorrect order. – gronostaj Aug 29 '16 at 22:30 -
if the post-calculation multiplication was intended, it would be marked by extra separating parentheses. – var firstName Aug 29 '16 at 22:34
-
@varfirstName "OP meant 8^((-1)^((-8)^7))". You don't know that. It's not what he wrote (in two different places). – DavidPostill Aug 29 '16 at 22:46
-
@gronostaj I think more properly stated is that Excel ranks negation first (unary minus), and then
exponentiation, thenmultiplication and division, thenaddition and subtraction. In Excel,-1is different from0-1. eg:-1^2►1.0-1^2►-1. The first is considered a unary operator, the second a binary operator. – Ron Rosenfeld Aug 31 '16 at 12:25
That's incorrect. -1^2 is 1. However, -1 to any odd power is -1; that is true. Using perfectly sensible logic, you can say that 8^(-1^(-8^7)). -8 ^ 7 = -2,097,152, an even number; therefore, -1^(-2,097,152) is 1/(-1^(2,097,152)) which reduces to 1/1 or simply 1, and 8^1 is 8. Your entry to WolframAlpha is flawed in some way.
EDIT: I did the calculation on Wolfram and it turns out that you entered it wrong. You're supposed to isolate the -1 further from the base, like this:
8^( (-1)^(-8^7) )
Wolfram spit this out back at me (identical to my entry):
8^((-1)^(-8^7))
- 1,777
-
1He says that -1 to any power is -1 which is completely incorrect. – var firstName Aug 29 '16 at 22:30
-
No, that's completely incorrect, any number to the -1 is 1 over that number – var firstName Aug 29 '16 at 22:32
-
My point is, he said negative one to any power is -1, which is incorrect. (negative one being the base, in all circumstances.) – var firstName Aug 29 '16 at 22:36
-
-
This is wrong. In math power operator has higher precedence than unary minus so -1^2 = -1, and it has right-to-left associativity so 2^3^4 = 2^(3^4). Almost all languages with power operator do follow the math rule like that. See Why is exponentiation applied right to left?, Why is exponentiation right associative? – phuclv Apr 16 '20 at 16:08


8^(-1^(-8^7)))has mismatched parentheses and is therefore an invalid expression. – DavidPostill Aug 29 '16 at 22:43=8^(-1^(-8^7))= 8 vs=8^(-(1^(-(8^7))))= 0.125 – Brad Aug 29 '16 at 23:57