It's a precedence thing. Google thinks (-1)0 = 1, as does Python:
>>> (-1)**0
1
Вопрос
As google suggests -10=-1. And as I understand pow() function in javascript, python and C should return the same result. But it's not true. Why?
Python:
>>> pow(-1, 0)
1
Решение
It's a precedence thing. Google thinks (-1)0 = 1, as does Python:
>>> (-1)**0
1
Другие советы
You forgot the parenthesis!
-1 ^ 0 = -(1 ^ 0) = -(1) = -1
because power operator has higher precedence.
But:
(-1)^0 = 1
Anything to the power of 0 will result to 1.
Remember BEDMASS. Your google example executes Brackets (1^0) which is 1, then you executed Multiplication, negating your expression in the brackets to -1.
(-10) is the same as saying (-1/-1) which is 1.
In division you substract the exponent of the denominator from the exponent of the numerator. For this rule to hold true all number elevated to the power of zero is 1. 51 / 51 = 50 = 1