Why pow(-1, 0) returns 1 instead of -1? -


as google suggests -10=-1. , understand pow() function in javascript, python , c should return same result. it's not true. why?

python:

>>> pow(-1, 0) 1 

it's precedence thing. google thinks (-1)0 = 1, python:

>>> (-1)**0 1 

any nonzero number raised exponent 0 1.


Comments

Popular posts from this blog

Using 'OR' and 'AND' in SQL Server -

python - Finding intersection between ellipse and a line -

c++ - NetBeans Remote Development with additional configuration -