| 1 |
// Copyright 2009 the Sputnik authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
description: If base < 0 and base is finite and exponent is finite and exponent is not an integer, the result is NaN. |
| 6 |
esid: sec-applying-the-exp-operator |
| 7 |
---*/ |
| 8 |
|
| 9 |
|
| 10 |
var exponent = new Array(); |
| 11 |
var base = new Array(); |
| 12 |
base[0] = -1.7976931348623157E308; //largest (by module) finite number |
| 13 |
base[1] = -Math.PI; |
| 14 |
base[2] = -1; |
| 15 |
base[3] = -0.000000000000001; |
| 16 |
var basenum = 4; |
| 17 |
|
| 18 |
exponent[0] = -Math.PI; |
| 19 |
exponent[1] = -Math.E; |
| 20 |
exponent[2] = -1.000000000000001; |
| 21 |
exponent[3] = -0.000000000000001; |
| 22 |
exponent[4] = 0.000000000000001; |
| 23 |
exponent[5] = 1.000000000000001; |
| 24 |
exponent[6] = Math.E; |
| 25 |
exponent[7] = Math.PI; |
| 26 |
|
| 27 |
var exponentnum = 8; |
| 28 |
|
| 29 |
for (var i = 0; i < basenum; i++) { |
| 30 |
for (var j = 0; j < exponentnum; j++) { |
| 31 |
assert.sameValue( |
| 32 |
Math.pow(base[i], exponent[j]), |
| 33 |
NaN, |
| 34 |
"(" + base[i] + ", " + exponent[j] + ")" |
| 35 |
); |
| 36 |
} |
| 37 |
} |