| 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: If base < 0 and base is finite and exponent is finite and exponent is not an integer, the result is NaN. |
| 7 |
---*/ |
| 8 |
|
| 9 |
|
| 10 |
var exponents = []; |
| 11 |
var bases = []; |
| 12 |
bases[0] = -1.7976931348623157E308; //largest (by module) finite number |
| 13 |
bases[1] = -Math.PI; |
| 14 |
bases[2] = -1; |
| 15 |
bases[3] = -0.000000000000001; |
| 16 |
|
| 17 |
exponents[0] = -Math.PI; |
| 18 |
exponents[1] = -Math.E; |
| 19 |
exponents[2] = -1.000000000000001; |
| 20 |
exponents[3] = -0.000000000000001; |
| 21 |
exponents[4] = 0.000000000000001; |
| 22 |
exponents[5] = 1.000000000000001; |
| 23 |
exponents[6] = Math.E; |
| 24 |
exponents[7] = Math.PI; |
| 25 |
|
| 26 |
for (var i = 0; i < bases.length; i++) { |
| 27 |
for (var j = 0; j < exponents.length; j++) { |
| 28 |
assert.sameValue( |
| 29 |
bases[i] ** exponents[j], |
| 30 |
NaN, |
| 31 |
bases[i] + " ** " + exponents[j] |
| 32 |
); |
| 33 |
} |
| 34 |
} |
| 35 |
|