exponent = args[2].data.u.number;
/*
- * Accordig to ECMA-262 the result of Math.pow(+/-1, +/-Infinity)
- * should be NaN.
+ * According to ECMA-262:
+ * 1. If exponent is NaN, the result should be NaN;
+ * 2. The result of Math.pow(+/-1, +/-Infinity) should be NaN.
*/
- if (fabs(base) != 1 || !isinf(exponent)) {
+ if (fabs(base) != 1 || (!isnan(exponent) && !isinf(exponent))) {
num = pow(base, exponent);
} else {
{ nxt_string("Math.pow()"),
nxt_string("NaN") },
+ { nxt_string("Math.pow(1, NaN)"),
+ nxt_string("NaN") },
+
+ { nxt_string("Math.pow(3, NaN)"),
+ nxt_string("NaN") },
+
{ nxt_string("Math.pow('a', -0)"),
nxt_string("1") },