Search code examples
javascriptmathinfinity

Math.pow and Infinity


There are seven indeterminate forms in maths. Most of them returns NaN in JavaScript. But when i try:

Math.pow( 0, 0 )

or

Math.pow( Infinity, 0 )

it returns:

1

Is this some kind of bug?


Solution

  • That's what the specification says, so it's not a bug:

    2. If y is +0, the result is 1, even if x is NaN.