Why is Math.pow(0, 0) === 1?

后端 未结 9 745
伪装坚强ぢ
伪装坚强ぢ 2020-11-30 01:47

We all know that 00 is indeterminate.

But, javascript says that:

Math.pow(0, 0) === 1 // true

9条回答
  •  误落风尘
    2020-11-30 02:12

    Donald Knuth

    sort of settled this debate in 1992 with the following:

    enter image description here

    And went even more into details in his paper Two Notes on Notation.

    Basically, while we don't have 1 as the limit of f(x)/g(x) for all not all functions f(x) and g(x), it still makes combinatorics so much simpler to define 0^0=1, and then just make special cases in the few places where you need to consider functions such as 0^x, which are weird anyway. After all x^0 comes up a lot more often.

    Some of the best discussions I know of this topic (other than the Knuth paper) are:

    • http://mathforum.org/dr.math/faq/faq.0.to.0.power.html
    • http://www.quora.com/Mathematics/What-is-math-0-0-math?share=1
    • https://math.stackexchange.com/questions/475337/the-binomial-formula-and-the-value-of-00

提交回复
热议问题