Debian Codegraph @

js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A3.js

raw
1 // Copyright 2016 Rick Waldron. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-applying-the-exp-operator
6 description: >
7 If exponent is −0, the result is 1, even if base is NaN.
8 features: [exponentiation]
9 ---*/
10
11
12 var exponent = -0;
13 var bases = [];
14 bases[0] = -Infinity;
15 bases[1] = -1.7976931348623157E308; //largest (by module) finite number
16 bases[2] = -0.000000000000001;
17 bases[3] = -0;
18 bases[4] = +0
19 bases[5] = 0.000000000000001;
20 bases[6] = 1.7976931348623157E308; //largest finite number
21 bases[7] = +Infinity;
22 bases[8] = NaN;
23
24 for (var i = 0; i < bases.length; i++) {
25 if ((bases[i] ** exponent) !== 1) {
26 throw new Test262Error("(" + bases[i] + " ** -0) !== 1");
27 }
28 }
29
30 reportCompare(0, 0);