Why does 0 ** 0 equal 1 in Python? Shouldn’t it throw an exception, like 0 / 0 does?
Why does 0 ** 0 equal 1 in Python? Shouldn’t it throw an exception,
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Wikipedia has interesting coverage of the history and the differing points of view on the value of
0 ** 0:As applied to computers, IEEE 754 recommends several functions for computing a power. It defines
pow(0, 0)andpown(0, 0)as returning1, andpowr(0, 0)as returningNaN.Most programming languages follow the convention that
0 ** 0 == 1. Python is no exception, both for integer and floating-point arguments.