+ 4

# Why 0**0 shows result 1 ?

0**0 ( 0 raise to 0 ) ( 0 to the power of 0 ) is one of the indeterminate. It is undefined, so, why JavaScript, Java, and Python are showing result 1. I have only tried this in JavaScript, Java, and Python. On the other hand they are showing 0/0 undefined. 0⁰ is same as 0/0 because, 0⁰ = 0¹⁻¹ = 0¹ × 0⁻¹ = 0/0 https://code.sololearn.com/cicCJrMFRQv7/?ref=app https://code.sololearn.com/c02ksJH6xylu/?ref=app https://code.sololearn.com/cUv0w7ERwg5N/?ref=app

4 odpowiedzi

+ 7

According to the wikipedia, "in algebra and combinatorics, the generally agreed upon value is 0**0=1".
https://en.m.wikipedia.org/wiki/Zero_to_the_power_of_zero
In other words, 0**0 = 1 by convention, and defining the expression as `lim x**0` is considered to be more useful than `lim 0**x` (as x goes to 0). I tend to agree, because raising something to the 0th power is like the empty product which is defined as 1.

+ 3

I understood any number raised to the power of zero is 1, but I never thought of doing (0 raised to 0).
I think most languages agreed to that, I had just recently tried it in Code Playground on C, C++, C# PHP, and got the same result.

0

Good

- 1

me