applying-the-exp-operator_A23.js (960B)
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 features: [exponentiation] 8 ---*/ 9 10 11 var exponents = []; 12 var bases = []; 13 bases[0] = -1.7976931348623157E308; //largest (by module) finite number 14 bases[1] = -Math.PI; 15 bases[2] = -1; 16 bases[3] = -0.000000000000001; 17 18 exponents[0] = -Math.PI; 19 exponents[1] = -Math.E; 20 exponents[2] = -1.000000000000001; 21 exponents[3] = -0.000000000000001; 22 exponents[4] = 0.000000000000001; 23 exponents[5] = 1.000000000000001; 24 exponents[6] = Math.E; 25 exponents[7] = Math.PI; 26 27 for (var i = 0; i < bases.length; i++) { 28 for (var j = 0; j < exponents.length; j++) { 29 assert.sameValue( 30 bases[i] ** exponents[j], 31 NaN, 32 bases[i] + " ** " + exponents[j] 33 ); 34 } 35 } 36 37 38 reportCompare(0, 0);