Why is Math.pow (1, NaN) equal to NaN in JavaScript?

In IEEE 754-2008, the section "9.2.1 Special Values" refers to

pow(+1, y) 1for anyone y(even quiet NaN)

In order not to read the entire document, Wikipedia gives a shortcut :

The 2008 version of the IEEE 754 standard says that pow(1, qNaN)they pow(qNaN, 0)should return 1, since they return 1what else instead of quiet NaN.

Why then Math.pow(1, NaN)is there NaNin JavaScript? Isn't that up to standards?

+5
source share
3 answers

This is because the ECMAscript specification seems to say so.

pow (x, y)

x y.

  • y - NaN, : NaN.
  • ... ...
+5

, pow IEEE 754 2008 . .

, ECMAScript pow NaN, NaN, 1997, 15.8.2.13 .

, ECMA JavaScript IEEE.

+2

, NaN - " ", - undefined. 1 undefined undefined.

+1

All Articles