test262/test/language/expressions/exponentiation/applying-the-exp-operator_A4.js
Leo Balter e49d2661a8 Improve assertions comparing values to NaN (#690)
The global isNaN is not precise at all, and Number.isNaN is an ES6 feature that makes it preferrable to use assert's sameValue for NaN values, as it handles it internally using the comparison.
2016-07-01 11:22:55 -07:00

27 lines
705 B
JavaScript

// Copyright 2016 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-applying-the-exp-operator
description: If base is NaN and exponent is nonzero, the result is NaN.
---*/
var base = NaN;
var exponents = [];
exponents[0] = -Infinity;
exponents[1] = -1.7976931348623157E308; //largest (by module) finite number
exponents[2] = -0.000000000000001;
exponents[3] = 0.000000000000001;
exponents[4] = 1.7976931348623157E308; //largest finite number
exponents[5] = +Infinity;
exponents[6] = NaN;
for (var i = 0; i < exponents.length; i++) {
assert.sameValue(
base ** exponents[i],
NaN,
base + " ** " + exponents[i]
);
}