mirror of https://github.com/tc39/test262.git
Exponentiation Operator tests
This commit is contained in:
parent
fc9bdb7cd5
commit
2a112a3190
|
@ -1,31 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If y is NaN, Math.pow(x,y) is NaN
|
||||
es5id: 15.8.2.13_A1
|
||||
description: Checking if Math.pow(x,y) is NaN, where y is NaN
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var y = NaN;
|
||||
var x = new Array();
|
||||
x[0] = -Infinity;
|
||||
x[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
x[2] = -0.000000000000001;
|
||||
x[3] = -0;
|
||||
x[4] = +0
|
||||
x[5] = 0.000000000000001;
|
||||
x[6] = 1.7976931348623157E308; //largest finite number
|
||||
x[7] = +Infinity;
|
||||
x[8] = NaN;
|
||||
var xnum = 9;
|
||||
|
||||
for (var i = 0; i < xnum; i++)
|
||||
{
|
||||
if (!isNaN(Math.pow(x[i],y)))
|
||||
{
|
||||
$ERROR("#1: isNaN(Math.pow(" + x[i] + ", " + y + ")) === false");
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If abs(x)<1 and y is -Infinity, Math.pow(x,y) is +Infinity
|
||||
es5id: 15.8.2.13_A10
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to +Infinity, where abs(x)<1 and
|
||||
y is -Infinity
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var y = -Infinity;
|
||||
var x = new Array();
|
||||
x[0] = 0.999999999999999;
|
||||
x[1] = 0.5;
|
||||
x[2] = +0;
|
||||
x[3] = -0;
|
||||
x[4] = -0.5;
|
||||
x[5] = -0.999999999999999;
|
||||
var xnum = 6;
|
||||
|
||||
for (var i = 0; i < xnum; i++)
|
||||
{
|
||||
if (Math.pow(x[i],y) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x[i] + ", " + y + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If x is +Infinity and y>0, Math.pow(x,y) is +Infinity
|
||||
es5id: 15.8.2.13_A11
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to +Infinity, where x is
|
||||
+Infinity and y>0
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var x = +Infinity;
|
||||
var y = new Array();
|
||||
y[3] = Infinity;
|
||||
y[2] = 1.7976931348623157E308; //largest (by module) finite number
|
||||
y[1] = 1;
|
||||
y[0] = 0.000000000000001;
|
||||
var ynum = 4;
|
||||
|
||||
for (var i = 0; i < ynum; i++)
|
||||
{
|
||||
if (Math.pow(x,y[i]) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x + ", " + y[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If x is +Infinity and y<0, Math.pow(x,y) is +0
|
||||
es5id: 15.8.2.13_A12
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to +0, where x is +Infinity and
|
||||
y<0
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var x = +Infinity;
|
||||
var y = new Array();
|
||||
y[0] = -Infinity;
|
||||
y[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
y[2] = -1;
|
||||
y[3] = -0.000000000000001;
|
||||
var ynum = 4;
|
||||
|
||||
for (var i = 0; i < ynum; i++)
|
||||
{
|
||||
if (Math.pow(x,y[i]) !== +0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x + ", " + y[i] + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: >
|
||||
If x is -Infinity and y>0 and y is an odd integer, Math.pow(x,y) is
|
||||
-Infinity
|
||||
es5id: 15.8.2.13_A13
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to -Infinity, where x is
|
||||
-Infinity and y>0
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var x = -Infinity;
|
||||
var y = new Array();
|
||||
y[0] = 1;
|
||||
y[1] = 111;
|
||||
y[2] = 111111;
|
||||
var ynum = 3;
|
||||
|
||||
for (var i = 0; i < ynum; i++)
|
||||
{
|
||||
if (Math.pow(x,y[i]) !== -Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x + ", " + y[i] + ") !== -Infinity");
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: >
|
||||
If x is -Infinity and y>0 and y is NOT an odd integer, Math.pow(x,y) is
|
||||
+Infinity
|
||||
es5id: 15.8.2.13_A14
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to +Infinity, where x is
|
||||
-Infinity and y>0
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var x = -Infinity;
|
||||
var y = new Array();
|
||||
y[0] = 0.000000000000001;
|
||||
y[1] = 2;
|
||||
y[2] = Math.PI;
|
||||
y[3] = 1.7976931348623157E308; //largest finite number
|
||||
y[4] = +Infinity;
|
||||
var ynum = 5;
|
||||
|
||||
for (var i = 0; i < ynum; i++)
|
||||
{
|
||||
if (Math.pow(x,y[i]) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x + ", " + y[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If x is -Infinity and y<0 and y is an odd integer, Math.pow(x,y) is -0
|
||||
es5id: 15.8.2.13_A15
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to -0, where x is -Infinity and
|
||||
y<0
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var x = -Infinity;
|
||||
var y = new Array();
|
||||
y[2] = -1;
|
||||
y[1] = -111;
|
||||
y[0] = -111111;
|
||||
var ynum = 3;
|
||||
|
||||
for (var i = 0; i < ynum; i++)
|
||||
{
|
||||
if (Math.pow(x,y[i]) !== -0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x + ", " + y[i] + ") !== -0");
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If x is -Infinity and y<0 and y is NOT an odd integer, Math.pow(x,y) is +0
|
||||
es5id: 15.8.2.13_A16
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to +0, where x is -Infinity and
|
||||
y<0
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var x = -Infinity;
|
||||
var y = new Array();
|
||||
y[4] = -0.000000000000001;
|
||||
y[3] = -2;
|
||||
y[2] = -Math.PI;
|
||||
y[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
y[0] = -Infinity;
|
||||
var ynum = 5;
|
||||
|
||||
for (var i = 0; i < ynum; i++)
|
||||
{
|
||||
if (Math.pow(x,y[i]) !== +0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x + ", " + y[i] + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If x is +0 and y>0, Math.pow(x,y) is +0
|
||||
es5id: 15.8.2.13_A17
|
||||
description: Checking if Math.pow(x,y) equals to +0, where x is +0 and y>0
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var x = +0;
|
||||
var y = new Array();
|
||||
y[3] = Infinity;
|
||||
y[2] = 1.7976931348623157E308; //largest finite number
|
||||
y[1] = 1;
|
||||
y[0] = 0.000000000000001;
|
||||
var ynum = 4;
|
||||
|
||||
for (var i = 0; i < ynum; i++)
|
||||
{
|
||||
if (Math.pow(x,y[i]) !== +0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x + ", " + y[i] + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If x is +0 and y<0, Math.pow(x,y) is +Infinity
|
||||
es5id: 15.8.2.13_A18
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to +Infinity, where x is +0 and
|
||||
y<0
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var x = +0;
|
||||
var y = new Array();
|
||||
y[0] = -Infinity;
|
||||
y[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
y[2] = -1;
|
||||
y[3] = -0.000000000000001;
|
||||
var ynum = 4;
|
||||
|
||||
for (var i = 0; i < ynum; i++)
|
||||
{
|
||||
if (Math.pow(x,y[i]) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x + ", " + y[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If x is -0 and y>0 and y is an odd integer, Math.pow(x,y) is -0
|
||||
es5id: 15.8.2.13_A19
|
||||
description: Checking if Math.pow(x,y) equals to -0, where x is -0 and y>0
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var x = -0;
|
||||
var y = new Array();
|
||||
y[0] = 1;
|
||||
y[1] = 111;
|
||||
y[2] = 111111;
|
||||
var ynum = 3;
|
||||
|
||||
for (var i = 0; i < ynum; i++)
|
||||
{
|
||||
if (Math.pow(x,y[i]) !== -0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x + ", " + y[i] + ") !== -0");
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If y is +0, Math.pow(x,y) is 1, even if x is NaN
|
||||
es5id: 15.8.2.13_A2
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to 1, where y is +0 and x is
|
||||
number or NaN
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var y = +0;
|
||||
var x = new Array();
|
||||
x[0] = -Infinity;
|
||||
x[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
x[2] = -0.000000000000001;
|
||||
x[3] = -0;
|
||||
x[4] = +0
|
||||
x[5] = 0.000000000000001;
|
||||
x[6] = 1.7976931348623157E308; //largest finite number
|
||||
x[7] = +Infinity;
|
||||
x[8] = NaN;
|
||||
var xnum = 9;
|
||||
|
||||
for (var i = 0; i < xnum; i++)
|
||||
{
|
||||
if (Math.pow(x[i],y) !== 1)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x[i] + ", " + y + ") !== 1");
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If x is -0 and y>0 and y is NOT an odd integer, Math.pow(x,y) is +0
|
||||
es5id: 15.8.2.13_A20
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to +0, where x is -0 and y>0 and
|
||||
y is NOT an odd integer
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var x = -0;
|
||||
var y = new Array();
|
||||
y[0] = 0.000000000000001;
|
||||
y[1] = 2;
|
||||
y[2] = Math.PI;
|
||||
y[3] = 1.7976931348623157E308; //largest finite number
|
||||
y[4] = +Infinity;
|
||||
var ynum = 5;
|
||||
|
||||
for (var i = 0; i < ynum; i++)
|
||||
{
|
||||
if (Math.pow(x,y[i]) !== +0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x + ", " + y[i] + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If x is -0 and y<0 and y is an odd integer, Math.pow(x,y) is -Infinity
|
||||
es5id: 15.8.2.13_A21
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to -Infinity, where x is -0 and y
|
||||
is an odd integer
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var x = -0;
|
||||
var y = new Array();
|
||||
y[2] = -1;
|
||||
y[1] = -111;
|
||||
y[0] = -111111;
|
||||
var ynum = 3;
|
||||
|
||||
for (var i = 0; i < ynum; i++)
|
||||
{
|
||||
if (Math.pow(x,y[i]) !== -Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x + ", " + y[i] + ") !== -Infinity");
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If x is -0 and y<0 and y is NOT an odd integer, Math.pow(x,y) is +Infinity
|
||||
es5id: 15.8.2.13_A22
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to +Infinity, where x is -0 and
|
||||
y<0 and y is NOT an odd integer
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var x = -0;
|
||||
var y = new Array();
|
||||
y[4] = -0.000000000000001;
|
||||
y[3] = -2;
|
||||
y[2] = -Math.PI;
|
||||
y[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
y[0] = -Infinity;
|
||||
var ynum = 5;
|
||||
|
||||
for (var i = 0; i < ynum; i++)
|
||||
{
|
||||
if (Math.pow(x,y[i]) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x + ", " + y[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: >
|
||||
If x<0 and x is finite and y is finite and y is not an integer,
|
||||
Math.pow(x,y) is NaN
|
||||
es5id: 15.8.2.13_A23
|
||||
description: >
|
||||
Checking if Math.pow(x,y) is NaN, where x<0 and x is finite and y
|
||||
is finite and y is not an integer
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var y = new Array();
|
||||
var x = new Array();
|
||||
x[0] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
x[1] = -Math.PI;
|
||||
x[2] = -1;
|
||||
x[3] = -0.000000000000001;
|
||||
var xnum = 4;
|
||||
|
||||
y[0] = -Math.PI;
|
||||
y[1] = -Math.E;
|
||||
y[2] = -1.000000000000001;
|
||||
y[3] = -0.000000000000001;
|
||||
y[4] = 0.000000000000001;
|
||||
y[5] = 1.000000000000001;
|
||||
y[6] = Math.E;
|
||||
y[7] = Math.PI;
|
||||
var ynum = 8;
|
||||
|
||||
for (var i = 0; i < xnum; i++)
|
||||
for (var j = 0; j < ynum; j++)
|
||||
if (!isNaN(Math.pow(x[i],y[j])))
|
||||
$ERROR("#1: isNaN(Math.pow(" + x[i] + ", " + y[j] + ")) === false");
|
|
@ -1,231 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: >
|
||||
Math.pow, recommended that implementations use the approximation
|
||||
algorithms for IEEE 754 arithmetic contained in fdlibm
|
||||
es5id: 15.8.2.13_A24
|
||||
description: >
|
||||
Checking if Math.pow(argument1, argument2) is approximately equals
|
||||
to its mathematical value on the set of 64 argument1 values and 64
|
||||
argument2 values; all the sample values is calculated with LibC
|
||||
includes:
|
||||
- math_precision.js
|
||||
- math_isequal.js
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
var vnum = 64;
|
||||
var x1 = new Array();
|
||||
x1[0] = 0.00000000000000000000;
|
||||
x1[1] = 0.25396825396825395000;
|
||||
x1[2] = 0.50793650793650791000;
|
||||
x1[3] = 0.76190476190476186000;
|
||||
x1[4] = 1.01587301587301580000;
|
||||
x1[5] = 1.26984126984126980000;
|
||||
x1[6] = 1.52380952380952370000;
|
||||
x1[7] = 1.77777777777777770000;
|
||||
x1[8] = 2.03174603174603160000;
|
||||
x1[9] = 2.28571428571428560000;
|
||||
x1[10] = 2.53968253968253950000;
|
||||
x1[11] = 2.79365079365079350000;
|
||||
x1[12] = 3.04761904761904740000;
|
||||
x1[13] = 3.30158730158730140000;
|
||||
x1[14] = 3.55555555555555540000;
|
||||
x1[15] = 3.80952380952380930000;
|
||||
x1[16] = 4.06349206349206330000;
|
||||
x1[17] = 4.31746031746031720000;
|
||||
x1[18] = 4.57142857142857120000;
|
||||
x1[19] = 4.82539682539682510000;
|
||||
x1[20] = 5.07936507936507910000;
|
||||
x1[21] = 5.33333333333333300000;
|
||||
x1[22] = 5.58730158730158700000;
|
||||
x1[23] = 5.84126984126984090000;
|
||||
x1[24] = 6.09523809523809490000;
|
||||
x1[25] = 6.34920634920634890000;
|
||||
x1[26] = 6.60317460317460280000;
|
||||
x1[27] = 6.85714285714285680000;
|
||||
x1[28] = 7.11111111111111070000;
|
||||
x1[29] = 7.36507936507936470000;
|
||||
x1[30] = 7.61904761904761860000;
|
||||
x1[31] = 7.87301587301587260000;
|
||||
x1[32] = 8.12698412698412650000;
|
||||
x1[33] = 8.38095238095238140000;
|
||||
x1[34] = 8.63492063492063440000;
|
||||
x1[35] = 8.88888888888888930000;
|
||||
x1[36] = 9.14285714285714230000;
|
||||
x1[37] = 9.39682539682539720000;
|
||||
x1[38] = 9.65079365079365030000;
|
||||
x1[39] = 9.90476190476190510000;
|
||||
x1[40] = 10.15873015873015800000;
|
||||
x1[41] = 10.41269841269841300000;
|
||||
x1[42] = 10.66666666666666600000;
|
||||
x1[43] = 10.92063492063492100000;
|
||||
x1[44] = 11.17460317460317400000;
|
||||
x1[45] = 11.42857142857142900000;
|
||||
x1[46] = 11.68253968253968200000;
|
||||
x1[47] = 11.93650793650793700000;
|
||||
x1[48] = 12.19047619047619000000;
|
||||
x1[49] = 12.44444444444444500000;
|
||||
x1[50] = 12.69841269841269800000;
|
||||
x1[51] = 12.95238095238095300000;
|
||||
x1[52] = 13.20634920634920600000;
|
||||
x1[53] = 13.46031746031746000000;
|
||||
x1[54] = 13.71428571428571400000;
|
||||
x1[55] = 13.96825396825396800000;
|
||||
x1[56] = 14.22222222222222100000;
|
||||
x1[57] = 14.47619047619047600000;
|
||||
x1[58] = 14.73015873015872900000;
|
||||
x1[59] = 14.98412698412698400000;
|
||||
x1[60] = 15.23809523809523700000;
|
||||
x1[61] = 15.49206349206349200000;
|
||||
x1[62] = 15.74603174603174500000;
|
||||
x1[63] = 16.00000000000000000000;
|
||||
|
||||
|
||||
|
||||
var x2 = new Array();
|
||||
x2[0] = -16.00000000000000000000;
|
||||
x2[1] = -15.49206349206349200000;
|
||||
x2[2] = -14.98412698412698400000;
|
||||
x2[3] = -14.47619047619047600000;
|
||||
x2[4] = -13.96825396825396800000;
|
||||
x2[5] = -13.46031746031746000000;
|
||||
x2[6] = -12.95238095238095300000;
|
||||
x2[7] = -12.44444444444444500000;
|
||||
x2[8] = -11.93650793650793700000;
|
||||
x2[9] = -11.42857142857142900000;
|
||||
x2[10] = -10.92063492063492100000;
|
||||
x2[11] = -10.41269841269841300000;
|
||||
x2[12] = -9.90476190476190510000;
|
||||
x2[13] = -9.39682539682539720000;
|
||||
x2[14] = -8.88888888888888930000;
|
||||
x2[15] = -8.38095238095238140000;
|
||||
x2[16] = -7.87301587301587350000;
|
||||
x2[17] = -7.36507936507936560000;
|
||||
x2[18] = -6.85714285714285770000;
|
||||
x2[19] = -6.34920634920634970000;
|
||||
x2[20] = -5.84126984126984180000;
|
||||
x2[21] = -5.33333333333333390000;
|
||||
x2[22] = -4.82539682539682600000;
|
||||
x2[23] = -4.31746031746031810000;
|
||||
x2[24] = -3.80952380952381020000;
|
||||
x2[25] = -3.30158730158730230000;
|
||||
x2[26] = -2.79365079365079440000;
|
||||
x2[27] = -2.28571428571428650000;
|
||||
x2[28] = -1.77777777777777860000;
|
||||
x2[29] = -1.26984126984127070000;
|
||||
x2[30] = -0.76190476190476275000;
|
||||
x2[31] = -0.25396825396825484000;
|
||||
x2[32] = 0.25396825396825307000;
|
||||
x2[33] = 0.76190476190476275000;
|
||||
x2[34] = 1.26984126984126890000;
|
||||
x2[35] = 1.77777777777777860000;
|
||||
x2[36] = 2.28571428571428470000;
|
||||
x2[37] = 2.79365079365079440000;
|
||||
x2[38] = 3.30158730158730050000;
|
||||
x2[39] = 3.80952380952381020000;
|
||||
x2[40] = 4.31746031746031630000;
|
||||
x2[41] = 4.82539682539682600000;
|
||||
x2[42] = 5.33333333333333210000;
|
||||
x2[43] = 5.84126984126984180000;
|
||||
x2[44] = 6.34920634920634800000;
|
||||
x2[45] = 6.85714285714285770000;
|
||||
x2[46] = 7.36507936507936380000;
|
||||
x2[47] = 7.87301587301587350000;
|
||||
x2[48] = 8.38095238095237960000;
|
||||
x2[49] = 8.88888888888888930000;
|
||||
x2[50] = 9.39682539682539540000;
|
||||
x2[51] = 9.90476190476190510000;
|
||||
x2[52] = 10.41269841269841100000;
|
||||
x2[53] = 10.92063492063492100000;
|
||||
x2[54] = 11.42857142857142700000;
|
||||
x2[55] = 11.93650793650793700000;
|
||||
x2[56] = 12.44444444444444300000;
|
||||
x2[57] = 12.95238095238095300000;
|
||||
x2[58] = 13.46031746031745900000;
|
||||
x2[59] = 13.96825396825396800000;
|
||||
x2[60] = 14.47619047619047400000;
|
||||
x2[61] = 14.98412698412698400000;
|
||||
x2[62] = 15.49206349206349000000;
|
||||
x2[63] = 16.00000000000000000000;
|
||||
|
||||
|
||||
var y = new Array();
|
||||
y[0] = +Infinity;
|
||||
y[1] = 1664158979.11096290000000000000;
|
||||
y[2] = 25596.98862206424700000000;
|
||||
y[3] = 51.24224360332205900000;
|
||||
y[4] = 0.80253721621001273000;
|
||||
y[5] = 0.04013281604184240600;
|
||||
y[6] = 0.00427181167466968250;
|
||||
y[7] = 0.00077698684629307839;
|
||||
y[8] = 0.00021140449751288852;
|
||||
y[9] = 0.00007886641216275820;
|
||||
y[10] = 0.00003797970495625904;
|
||||
y[11] = 0.00002260186576944384;
|
||||
y[12] = 0.00001608735704675994;
|
||||
y[13] = 0.00001335526639440840;
|
||||
y[14] = 0.00001267782407825002;
|
||||
y[15] = 0.00001354410739307298;
|
||||
y[16] = 0.00001607404700077214;
|
||||
y[17] = 0.00002096489798949858;
|
||||
y[18] = 0.00002978033411316872;
|
||||
y[19] = 0.00004572015769326707;
|
||||
y[20] = 0.00007536620884896827;
|
||||
y[21] = 0.00013263967558882687;
|
||||
y[22] = 0.00024800091950917796;
|
||||
y[23] = 0.00049049578772052680;
|
||||
y[24] = 0.00102225521238885490;
|
||||
y[25] = 0.00223744147356661880;
|
||||
y[26] = 0.00512739755878587920;
|
||||
y[27] = 0.01226918030754863000;
|
||||
y[28] = 0.03058049475427409400;
|
||||
y[29] = 0.07921771472569966200;
|
||||
y[30] = 0.21285098601167457000;
|
||||
y[31] = 0.59211846233860321000;
|
||||
y[32] = 1.70252376919407730000;
|
||||
y[33] = 5.05197994186350920000;
|
||||
y[34] = 15.44896866758827700000;
|
||||
y[35] = 48.62279949816147700000;
|
||||
y[36] = 157.31086033139039000000;
|
||||
y[37] = 522.60021277476767000000;
|
||||
y[38] = 1780.82316713426990000000;
|
||||
y[39] = 6218.58509846337710000000;
|
||||
y[40] = 22232.54916898025500000000;
|
||||
y[41] = 81310.50695814844200000000;
|
||||
y[42] = 303962.39599994919000000000;
|
||||
y[43] = 1160609.39151835810000000000;
|
||||
y[44] = 4523160.16396183520000000000;
|
||||
y[45] = 17980506.53105686600000000000;
|
||||
y[46] = 72861260.63140085300000000000;
|
||||
y[47] = 300795965.18372804000000000000;
|
||||
y[48] = 1264408843.88636260000000000000;
|
||||
y[49] = 5408983705.82595920000000000000;
|
||||
y[50] = 23536438485.32324600000000000000;
|
||||
y[51] = 104125724201.77888000000000000000;
|
||||
y[52] = 468137079409.17462000000000000000;
|
||||
y[53] = 2137965865913.91260000000000000000;
|
||||
y[54] = 9914368643808.25200000000000000000;
|
||||
y[55] = 46665726995317.89800000000000000000;
|
||||
y[56] = 222863786409039.87000000000000000000;
|
||||
y[57] = 1079534443702065.00000000000000000000;
|
||||
y[58] = 5302037850329952.00000000000000000000;
|
||||
y[59] = 26394813313751084.00000000000000000000;
|
||||
y[60] = 133146543235024720.00000000000000000000;
|
||||
y[61] = 680375082351885950.00000000000000000000;
|
||||
y[62] = 3520878542447823900.00000000000000000000;
|
||||
y[63] = 18446744073709552000.00000000000000000000;
|
||||
|
||||
|
||||
|
||||
var val;
|
||||
for (var i = 0; i < vnum; i++)
|
||||
{
|
||||
val = Math.pow(x1[i], x2[i]);
|
||||
if (!isEqual(val, y[i]))
|
||||
{
|
||||
$ERROR("\nx1 = " + x1[i] + "\nx2 = " + x2[i] + "\nlibc.pow(x1,x2) = " + y[i] + "\nMath.pow(x1,x2) = " + Math.pow(x1[i], x2[i]) + "\nMath.abs(libc.pow(x1,x2) - Math.pow(x1,x2)) > " + prec + "\n\n");
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If y is -0, Math.pow(x,y) is 1, even if x is NaN
|
||||
es5id: 15.8.2.13_A3
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to 1, where x is number or NaN
|
||||
and y is -0
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var y = +0;
|
||||
var x = new Array();
|
||||
x[0] = -Infinity;
|
||||
x[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
x[2] = -0.000000000000001;
|
||||
x[3] = -0;
|
||||
x[4] = +0
|
||||
x[5] = 0.000000000000001;
|
||||
x[6] = 1.7976931348623157E308; //largest finite number
|
||||
x[7] = +Infinity;
|
||||
x[8] = NaN;
|
||||
var xnum = 9;
|
||||
|
||||
for (var i = 0; i < xnum; i++)
|
||||
{
|
||||
if (Math.pow(x[i],y) !== 1)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x[i] + ", -0) !== 1");
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If x is NaN and y is nonzero, Math.pow(x,y) is NaN
|
||||
es5id: 15.8.2.13_A4
|
||||
description: Checking if Math.pow(x,y) is NaN, where x is NaN and y is nonzero
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var x = NaN;
|
||||
var y = new Array();
|
||||
y[0] = -Infinity;
|
||||
y[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
y[2] = -0.000000000000001;
|
||||
y[3] = 0.000000000000001;
|
||||
y[4] = 1.7976931348623157E308; //largest finite number
|
||||
y[5] = +Infinity;
|
||||
y[6] = NaN;
|
||||
var ynum = 7;
|
||||
|
||||
for (var i = 0; i < ynum; i++)
|
||||
{
|
||||
if (!isNaN(Math.pow(x,y[i])))
|
||||
{
|
||||
$ERROR("#1: isNaN(Math.pow(" + x + ", " + y[i] + ")) === false");
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If abs(x)>1 and y is +Infinity, Math.pow(x,y) is +Infinity
|
||||
es5id: 15.8.2.13_A5
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to +Infinity, where abs(x)>1 and
|
||||
y is +Infinity
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var y = +Infinity;
|
||||
var x = new Array();
|
||||
x[0] = -Infinity;
|
||||
x[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
x[2] = -1.000000000000001;
|
||||
x[3] = 1.000000000000001;
|
||||
x[4] = 1.7976931348623157E308; //largest finite number
|
||||
x[5] = +Infinity;
|
||||
var xnum = 6;
|
||||
|
||||
for (var i = 0; i < xnum; i++)
|
||||
{
|
||||
if (Math.pow(x[i],y) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x[i] + ", " + y + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If abs(x)>1 and y is -Infinity, Math.pow(x,y) is +0
|
||||
es5id: 15.8.2.13_A6
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to +0, where abs(x)>1 and y is
|
||||
-Infinity
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var y = -Infinity;
|
||||
var x = new Array();
|
||||
x[0] = -Infinity;
|
||||
x[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
x[2] = -1.000000000000001;
|
||||
x[3] = 1.000000000000001;
|
||||
x[4] = 1.7976931348623157E308; //largest finite number
|
||||
x[5] = +Infinity;
|
||||
var xnum = 6;
|
||||
|
||||
for (var i = 0; i < xnum; i++)
|
||||
{
|
||||
if (Math.pow(x[i],y) !== +0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x[i] + ", " + y + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If abs(x)==1 and y is +Infinity, Math.pow(x,y) is NaN
|
||||
es5id: 15.8.2.13_A7
|
||||
description: >
|
||||
Checking if Math.pow(x,y) is NaN, where abs(x)==1 and y is
|
||||
+Infinity
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var y = +Infinity;
|
||||
var x = new Array();
|
||||
x[0] = -1;
|
||||
x[1] = 1
|
||||
var xnum = 2;
|
||||
|
||||
for (var i = 0; i < xnum; i++)
|
||||
{
|
||||
if (!isNaN(Math.pow(x[i],y)))
|
||||
{
|
||||
$ERROR("#1: isNaN(Math.pow(" + x[i] + ", " + y + ")) === false");
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If abs(x)==1 and y is -Infinity, Math.pow(x,y) is NaN
|
||||
es5id: 15.8.2.13_A8
|
||||
description: >
|
||||
Checking if Math.pow(x,y) is NaN, where abs(x)==1 and y is
|
||||
-Infinity
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var y = -Infinity;
|
||||
var x = new Array();
|
||||
x[0] = -1;
|
||||
x[1] = 1
|
||||
var xnum = 2;
|
||||
|
||||
for (var i = 0; i < xnum; i++)
|
||||
{
|
||||
if (!isNaN(Math.pow(x[i],y)))
|
||||
{
|
||||
$ERROR("#1: isNaN(Math.pow(" + x[i] + ", " + y + ")) === false");
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If abs(x)<1 and y is +Infinity, Math.pow(x,y) is +0
|
||||
es5id: 15.8.2.13_A9
|
||||
description: >
|
||||
Checking if Math.pow(x,y) equals to +0, where abs(x)<1 and y is
|
||||
+Infinity
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
|
||||
var y = +Infinity;
|
||||
var x = new Array();
|
||||
x[0] = 0.999999999999999;
|
||||
x[1] = 0.5;
|
||||
x[2] = +0;
|
||||
x[3] = -0;
|
||||
x[4] = -0.5;
|
||||
x[5] = -0.999999999999999;
|
||||
var xnum = 6;
|
||||
|
||||
for (var i = 0; i < xnum; i++)
|
||||
{
|
||||
if (Math.pow(x[i],y) !== +0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + x[i] + ", " + y + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If exponent is NaN, the result is NaN.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = NaN;
|
||||
var base = new Array();
|
||||
base[0] = -Infinity;
|
||||
base[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
base[2] = -0.000000000000001;
|
||||
base[3] = -0;
|
||||
base[4] = +0
|
||||
base[5] = 0.000000000000001;
|
||||
base[6] = 1.7976931348623157E308; //largest finite number
|
||||
base[7] = +Infinity;
|
||||
base[8] = NaN;
|
||||
var basenum = 9;
|
||||
|
||||
for (var i = 0; i < basenum; i++)
|
||||
{
|
||||
if (!isNaN(Math.pow(base[i],exponent)))
|
||||
{
|
||||
$ERROR("#1: isNaN(Math.pow(" + base[i] + ", " + exponent + ")) === false");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If abs(base) < 1 and exponent is −∞, the result is +∞.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = -Infinity;
|
||||
var base = new Array();
|
||||
base[0] = 0.999999999999999;
|
||||
base[1] = 0.5;
|
||||
base[2] = +0;
|
||||
base[3] = -0;
|
||||
base[4] = -0.5;
|
||||
base[5] = -0.999999999999999;
|
||||
var basenum = 6;
|
||||
|
||||
for (var i = 0; i < basenum; i++)
|
||||
{
|
||||
if (Math.pow(base[i],exponent) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base is +∞ and exponent > 0, the result is +∞.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var base = +Infinity;
|
||||
var exponent = new Array();
|
||||
exponent[3] = Infinity;
|
||||
exponent[2] = 1.7976931348623157E308; //largest (by module) finite number
|
||||
exponent[1] = 1;
|
||||
exponent[0] = 0.000000000000001;
|
||||
var exponentnum = 4;
|
||||
|
||||
for (var i = 0; i < exponentnum; i++)
|
||||
{
|
||||
if (Math.pow(base,exponent[i]) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base is +∞ and exponent < 0, the result is +0.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var base = +Infinity;
|
||||
var exponent = new Array();
|
||||
exponent[0] = -Infinity;
|
||||
exponent[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
exponent[2] = -1;
|
||||
exponent[3] = -0.000000000000001;
|
||||
var exponentnum = 4;
|
||||
|
||||
for (var i = 0; i < exponentnum; i++)
|
||||
{
|
||||
if (Math.pow(base,exponent[i]) !== +0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base is −∞ and exponent > 0 and exponent is an odd integer, the result is −∞.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var base = -Infinity;
|
||||
var exponent = new Array();
|
||||
exponent[0] = 1;
|
||||
exponent[1] = 111;
|
||||
exponent[2] = 111111;
|
||||
var exponentnum = 3;
|
||||
|
||||
for (var i = 0; i < exponentnum; i++)
|
||||
{
|
||||
if (Math.pow(base,exponent[i]) !== -Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base is −∞ and exponent > 0 and exponent is not an odd integer, the result is +∞.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var base = -Infinity;
|
||||
var exponent = new Array();
|
||||
exponent[0] = 0.000000000000001;
|
||||
exponent[1] = 2;
|
||||
exponent[2] = Math.PI;
|
||||
exponent[3] = 1.7976931348623157E308; //largest finite number
|
||||
exponent[4] = +Infinity;
|
||||
var exponentnum = 5;
|
||||
|
||||
for (var i = 0; i < exponentnum; i++)
|
||||
{
|
||||
if (Math.pow(base,exponent[i]) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base is −∞ and exponent < 0 and exponent is an odd integer, the result is −0.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var base = -Infinity;
|
||||
var exponent = new Array();
|
||||
exponent[2] = -1;
|
||||
exponent[1] = -111;
|
||||
exponent[0] = -111111;
|
||||
var exponentnum = 3;
|
||||
|
||||
for (var i = 0; i < exponentnum; i++)
|
||||
{
|
||||
if (Math.pow(base,exponent[i]) !== -0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base is −∞ and exponent < 0 and exponent is not an odd integer, the result is +0.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var base = -Infinity;
|
||||
var exponent = new Array();
|
||||
exponent[4] = -0.000000000000001;
|
||||
exponent[3] = -2;
|
||||
exponent[2] = -Math.PI;
|
||||
exponent[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
exponent[0] = -Infinity;
|
||||
var exponentnum = 5;
|
||||
|
||||
for (var i = 0; i < exponentnum; i++)
|
||||
{
|
||||
if (Math.pow(base,exponent[i]) !== +0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base is +0 and exponent > 0, the result is +0.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var base = +0;
|
||||
var exponent = new Array();
|
||||
exponent[3] = Infinity;
|
||||
exponent[2] = 1.7976931348623157E308; //largest finite number
|
||||
exponent[1] = 1;
|
||||
exponent[0] = 0.000000000000001;
|
||||
var exponentnum = 4;
|
||||
|
||||
for (var i = 0; i < exponentnum; i++)
|
||||
{
|
||||
if (Math.pow(base,exponent[i]) !== +0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base is +0 and exponent < 0, the result is +∞.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var base = +0;
|
||||
var exponent = new Array();
|
||||
exponent[0] = -Infinity;
|
||||
exponent[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
exponent[2] = -1;
|
||||
exponent[3] = -0.000000000000001;
|
||||
var exponentnum = 4;
|
||||
|
||||
for (var i = 0; i < exponentnum; i++)
|
||||
{
|
||||
if (Math.pow(base,exponent[i]) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base is −0 and exponent > 0 and exponent is an odd integer, the result is −0.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var base = -0;
|
||||
var exponent = new Array();
|
||||
exponent[0] = 1;
|
||||
exponent[1] = 111;
|
||||
exponent[2] = 111111;
|
||||
var exponentnum = 3;
|
||||
|
||||
for (var i = 0; i < exponentnum; i++)
|
||||
{
|
||||
if (Math.pow(base,exponent[i]) !== -0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If exponent is +0, the result is 1, even if base is NaN.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = +0;
|
||||
var base = new Array();
|
||||
base[0] = -Infinity;
|
||||
base[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
base[2] = -0.000000000000001;
|
||||
base[3] = -0;
|
||||
base[4] = +0
|
||||
base[5] = 0.000000000000001;
|
||||
base[6] = 1.7976931348623157E308; //largest finite number
|
||||
base[7] = +Infinity;
|
||||
base[8] = NaN;
|
||||
var basenum = 9;
|
||||
|
||||
for (var i = 0; i < basenum; i++)
|
||||
{
|
||||
if (Math.pow(base[i],exponent) !== 1)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== 1");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base is −0 and exponent > 0 and exponent is not an odd integer, the result is +0.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var base = -0;
|
||||
var exponent = new Array();
|
||||
exponent[0] = 0.000000000000001;
|
||||
exponent[1] = 2;
|
||||
exponent[2] = Math.PI;
|
||||
exponent[3] = 1.7976931348623157E308; //largest finite number
|
||||
exponent[4] = +Infinity;
|
||||
var exponentnum = 5;
|
||||
|
||||
for (var i = 0; i < exponentnum; i++)
|
||||
{
|
||||
if (Math.pow(base,exponent[i]) !== +0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base is −0 and exponent < 0 and exponent is an odd integer, the result is −∞.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var base = -0;
|
||||
var exponent = new Array();
|
||||
exponent[2] = -1;
|
||||
exponent[1] = -111;
|
||||
exponent[0] = -111111;
|
||||
var exponentnum = 3;
|
||||
|
||||
for (var i = 0; i < exponentnum; i++)
|
||||
{
|
||||
if (Math.pow(base,exponent[i]) !== -Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base is −0 and exponent < 0 and exponent is not an odd integer, the result is +∞.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var base = -0;
|
||||
var exponent = new Array();
|
||||
exponent[4] = -0.000000000000001;
|
||||
exponent[3] = -2;
|
||||
exponent[2] = -Math.PI;
|
||||
exponent[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
exponent[0] = -Infinity;
|
||||
var exponentnum = 5;
|
||||
|
||||
for (var i = 0; i < exponentnum; i++)
|
||||
{
|
||||
if (Math.pow(base, exponent[i]) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base < 0 and base is finite and exponent is finite and exponent is not an integer, the result is NaN.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = new Array();
|
||||
var base = new Array();
|
||||
base[0] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
base[1] = -Math.PI;
|
||||
base[2] = -1;
|
||||
base[3] = -0.000000000000001;
|
||||
var basenum = 4;
|
||||
|
||||
exponent[0] = -Math.PI;
|
||||
exponent[1] = -Math.E;
|
||||
exponent[2] = -1.000000000000001;
|
||||
exponent[3] = -0.000000000000001;
|
||||
exponent[4] = 0.000000000000001;
|
||||
exponent[5] = 1.000000000000001;
|
||||
exponent[6] = Math.E;
|
||||
exponent[7] = Math.PI;
|
||||
|
||||
var exponentnum = 8;
|
||||
|
||||
for (var i = 0; i < basenum; i++)
|
||||
for (var j = 0; j < exponentnum; j++)
|
||||
if (!isNaN(Math.pow(base[i],exponent[j])))
|
||||
$ERROR("#1: isNaN(Math.pow(" + base[i] + ", " + exponent[j] + ")) === false");
|
|
@ -0,0 +1,227 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: >
|
||||
Checking if Math.pow(argument1, argument2) is approbaseimatelexponent equals
|
||||
to its mathematical value on the set of 64 argument1 values and 64
|
||||
argument2 values; all the sample values is calculated with LibC
|
||||
includes:
|
||||
- math_precision.js
|
||||
- math_isequal.js
|
||||
---*/
|
||||
|
||||
var vnum = 64;
|
||||
var base1 = new Array();
|
||||
base1[0] = 0.00000000000000000000;
|
||||
base1[1] = 0.25396825396825395000;
|
||||
base1[2] = 0.50793650793650791000;
|
||||
base1[3] = 0.76190476190476186000;
|
||||
base1[4] = 1.01587301587301580000;
|
||||
base1[5] = 1.26984126984126980000;
|
||||
base1[6] = 1.52380952380952370000;
|
||||
base1[7] = 1.77777777777777770000;
|
||||
base1[8] = 2.03174603174603160000;
|
||||
base1[9] = 2.28571428571428560000;
|
||||
base1[10] = 2.53968253968253950000;
|
||||
base1[11] = 2.79365079365079350000;
|
||||
base1[12] = 3.04761904761904740000;
|
||||
base1[13] = 3.30158730158730140000;
|
||||
base1[14] = 3.55555555555555540000;
|
||||
base1[15] = 3.80952380952380930000;
|
||||
base1[16] = 4.06349206349206330000;
|
||||
base1[17] = 4.31746031746031720000;
|
||||
base1[18] = 4.57142857142857120000;
|
||||
base1[19] = 4.82539682539682510000;
|
||||
base1[20] = 5.07936507936507910000;
|
||||
base1[21] = 5.33333333333333300000;
|
||||
base1[22] = 5.58730158730158700000;
|
||||
base1[23] = 5.84126984126984090000;
|
||||
base1[24] = 6.09523809523809490000;
|
||||
base1[25] = 6.34920634920634890000;
|
||||
base1[26] = 6.60317460317460280000;
|
||||
base1[27] = 6.85714285714285680000;
|
||||
base1[28] = 7.11111111111111070000;
|
||||
base1[29] = 7.36507936507936470000;
|
||||
base1[30] = 7.61904761904761860000;
|
||||
base1[31] = 7.87301587301587260000;
|
||||
base1[32] = 8.12698412698412650000;
|
||||
base1[33] = 8.38095238095238140000;
|
||||
base1[34] = 8.63492063492063440000;
|
||||
base1[35] = 8.88888888888888930000;
|
||||
base1[36] = 9.14285714285714230000;
|
||||
base1[37] = 9.39682539682539720000;
|
||||
base1[38] = 9.65079365079365030000;
|
||||
base1[39] = 9.90476190476190510000;
|
||||
base1[40] = 10.15873015873015800000;
|
||||
base1[41] = 10.41269841269841300000;
|
||||
base1[42] = 10.66666666666666600000;
|
||||
base1[43] = 10.92063492063492100000;
|
||||
base1[44] = 11.17460317460317400000;
|
||||
base1[45] = 11.42857142857142900000;
|
||||
base1[46] = 11.68253968253968200000;
|
||||
base1[47] = 11.93650793650793700000;
|
||||
base1[48] = 12.19047619047619000000;
|
||||
base1[49] = 12.44444444444444500000;
|
||||
base1[50] = 12.69841269841269800000;
|
||||
base1[51] = 12.95238095238095300000;
|
||||
base1[52] = 13.20634920634920600000;
|
||||
base1[53] = 13.46031746031746000000;
|
||||
base1[54] = 13.71428571428571400000;
|
||||
base1[55] = 13.96825396825396800000;
|
||||
base1[56] = 14.22222222222222100000;
|
||||
base1[57] = 14.47619047619047600000;
|
||||
base1[58] = 14.73015873015872900000;
|
||||
base1[59] = 14.98412698412698400000;
|
||||
base1[60] = 15.23809523809523700000;
|
||||
base1[61] = 15.49206349206349200000;
|
||||
base1[62] = 15.74603174603174500000;
|
||||
base1[63] = 16.00000000000000000000;
|
||||
|
||||
|
||||
|
||||
var base2 = new Array();
|
||||
base2[0] = -16.00000000000000000000;
|
||||
base2[1] = -15.49206349206349200000;
|
||||
base2[2] = -14.98412698412698400000;
|
||||
base2[3] = -14.47619047619047600000;
|
||||
base2[4] = -13.96825396825396800000;
|
||||
base2[5] = -13.46031746031746000000;
|
||||
base2[6] = -12.95238095238095300000;
|
||||
base2[7] = -12.44444444444444500000;
|
||||
base2[8] = -11.93650793650793700000;
|
||||
base2[9] = -11.42857142857142900000;
|
||||
base2[10] = -10.92063492063492100000;
|
||||
base2[11] = -10.41269841269841300000;
|
||||
base2[12] = -9.90476190476190510000;
|
||||
base2[13] = -9.39682539682539720000;
|
||||
base2[14] = -8.88888888888888930000;
|
||||
base2[15] = -8.38095238095238140000;
|
||||
base2[16] = -7.87301587301587350000;
|
||||
base2[17] = -7.36507936507936560000;
|
||||
base2[18] = -6.85714285714285770000;
|
||||
base2[19] = -6.34920634920634970000;
|
||||
base2[20] = -5.84126984126984180000;
|
||||
base2[21] = -5.33333333333333390000;
|
||||
base2[22] = -4.82539682539682600000;
|
||||
base2[23] = -4.31746031746031810000;
|
||||
base2[24] = -3.80952380952381020000;
|
||||
base2[25] = -3.30158730158730230000;
|
||||
base2[26] = -2.79365079365079440000;
|
||||
base2[27] = -2.28571428571428650000;
|
||||
base2[28] = -1.77777777777777860000;
|
||||
base2[29] = -1.26984126984127070000;
|
||||
base2[30] = -0.76190476190476275000;
|
||||
base2[31] = -0.25396825396825484000;
|
||||
base2[32] = 0.25396825396825307000;
|
||||
base2[33] = 0.76190476190476275000;
|
||||
base2[34] = 1.26984126984126890000;
|
||||
base2[35] = 1.77777777777777860000;
|
||||
base2[36] = 2.28571428571428470000;
|
||||
base2[37] = 2.79365079365079440000;
|
||||
base2[38] = 3.30158730158730050000;
|
||||
base2[39] = 3.80952380952381020000;
|
||||
base2[40] = 4.31746031746031630000;
|
||||
base2[41] = 4.82539682539682600000;
|
||||
base2[42] = 5.33333333333333210000;
|
||||
base2[43] = 5.84126984126984180000;
|
||||
base2[44] = 6.34920634920634800000;
|
||||
base2[45] = 6.85714285714285770000;
|
||||
base2[46] = 7.36507936507936380000;
|
||||
base2[47] = 7.87301587301587350000;
|
||||
base2[48] = 8.38095238095237960000;
|
||||
base2[49] = 8.88888888888888930000;
|
||||
base2[50] = 9.39682539682539540000;
|
||||
base2[51] = 9.90476190476190510000;
|
||||
base2[52] = 10.41269841269841100000;
|
||||
base2[53] = 10.92063492063492100000;
|
||||
base2[54] = 11.42857142857142700000;
|
||||
base2[55] = 11.93650793650793700000;
|
||||
base2[56] = 12.44444444444444300000;
|
||||
base2[57] = 12.95238095238095300000;
|
||||
base2[58] = 13.46031746031745900000;
|
||||
base2[59] = 13.96825396825396800000;
|
||||
base2[60] = 14.47619047619047400000;
|
||||
base2[61] = 14.98412698412698400000;
|
||||
base2[62] = 15.49206349206349000000;
|
||||
base2[63] = 16.00000000000000000000;
|
||||
|
||||
|
||||
var exponent = new Array();
|
||||
exponent[0] = +Infinity;
|
||||
exponent[1] = 1664158979.11096290000000000000;
|
||||
exponent[2] = 25596.98862206424700000000;
|
||||
exponent[3] = 51.24224360332205900000;
|
||||
exponent[4] = 0.80253721621001273000;
|
||||
exponent[5] = 0.04013281604184240600;
|
||||
exponent[6] = 0.00427181167466968250;
|
||||
exponent[7] = 0.00077698684629307839;
|
||||
exponent[8] = 0.00021140449751288852;
|
||||
exponent[9] = 0.00007886641216275820;
|
||||
exponent[10] = 0.00003797970495625904;
|
||||
exponent[11] = 0.00002260186576944384;
|
||||
exponent[12] = 0.00001608735704675994;
|
||||
exponent[13] = 0.00001335526639440840;
|
||||
exponent[14] = 0.00001267782407825002;
|
||||
exponent[15] = 0.00001354410739307298;
|
||||
exponent[16] = 0.00001607404700077214;
|
||||
exponent[17] = 0.00002096489798949858;
|
||||
exponent[18] = 0.00002978033411316872;
|
||||
exponent[19] = 0.00004572015769326707;
|
||||
exponent[20] = 0.00007536620884896827;
|
||||
exponent[21] = 0.00013263967558882687;
|
||||
exponent[22] = 0.00024800091950917796;
|
||||
exponent[23] = 0.00049049578772052680;
|
||||
exponent[24] = 0.00102225521238885490;
|
||||
exponent[25] = 0.00223744147356661880;
|
||||
exponent[26] = 0.00512739755878587920;
|
||||
exponent[27] = 0.01226918030754863000;
|
||||
exponent[28] = 0.03058049475427409400;
|
||||
exponent[29] = 0.07921771472569966200;
|
||||
exponent[30] = 0.21285098601167457000;
|
||||
exponent[31] = 0.59211846233860321000;
|
||||
exponent[32] = 1.70252376919407730000;
|
||||
exponent[33] = 5.05197994186350920000;
|
||||
exponent[34] = 15.44896866758827700000;
|
||||
exponent[35] = 48.62279949816147700000;
|
||||
exponent[36] = 157.31086033139039000000;
|
||||
exponent[37] = 522.60021277476767000000;
|
||||
exponent[38] = 1780.82316713426990000000;
|
||||
exponent[39] = 6218.58509846337710000000;
|
||||
exponent[40] = 22232.54916898025500000000;
|
||||
exponent[41] = 81310.50695814844200000000;
|
||||
exponent[42] = 303962.39599994919000000000;
|
||||
exponent[43] = 1160609.39151835810000000000;
|
||||
exponent[44] = 4523160.16396183520000000000;
|
||||
exponent[45] = 17980506.53105686600000000000;
|
||||
exponent[46] = 72861260.63140085300000000000;
|
||||
exponent[47] = 300795965.18372804000000000000;
|
||||
exponent[48] = 1264408843.88636260000000000000;
|
||||
exponent[49] = 5408983705.82595920000000000000;
|
||||
exponent[50] = 23536438485.32324600000000000000;
|
||||
exponent[51] = 104125724201.77888000000000000000;
|
||||
exponent[52] = 468137079409.17462000000000000000;
|
||||
exponent[53] = 2137965865913.91260000000000000000;
|
||||
exponent[54] = 9914368643808.25200000000000000000;
|
||||
exponent[55] = 46665726995317.89800000000000000000;
|
||||
exponent[56] = 222863786409039.87000000000000000000;
|
||||
exponent[57] = 1079534443702065.00000000000000000000;
|
||||
exponent[58] = 5302037850329952.00000000000000000000;
|
||||
exponent[59] = 26394813313751084.00000000000000000000;
|
||||
exponent[60] = 133146543235024720.00000000000000000000;
|
||||
exponent[61] = 680375082351885950.00000000000000000000;
|
||||
exponent[62] = 3520878542447823900.00000000000000000000;
|
||||
exponent[63] = 18446744073709552000.00000000000000000000;
|
||||
|
||||
|
||||
|
||||
var val;
|
||||
for (var i = 0; i < vnum; i++)
|
||||
{
|
||||
val = Math.pow(base1[i], base2[i]);
|
||||
if (!isEqual(val, exponent[i]))
|
||||
{
|
||||
$ERROR("\nbase1 = " + base1[i] + "\nbase2 = " + base2[i] + "\nlibc.pow(base1,base2) = " + exponent[i] + "\nMath.pow(base1,base2) = " + Math.pow(base1[i], base2[i]) + "\nMath.abs(libc.pow(base1,base2) - Math.pow(base1,base2)) > " + prec + "\n\n");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If exponent is −0, the result is 1, even if base is NaN.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = -0;
|
||||
var base = new Array();
|
||||
base[0] = -Infinity;
|
||||
base[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
base[2] = -0.000000000000001;
|
||||
base[3] = -0;
|
||||
base[4] = +0
|
||||
base[5] = 0.000000000000001;
|
||||
base[6] = 1.7976931348623157E308; //largest finite number
|
||||
base[7] = +Infinity;
|
||||
base[8] = NaN;
|
||||
var basenum = 9;
|
||||
|
||||
for (var i = 0; i < basenum; i++)
|
||||
{
|
||||
if (Math.pow(base[i],exponent) !== 1)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base[i] + ", -0) !== 1");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If base is NaN and exponent is nonzero, the result is NaN.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var base = NaN;
|
||||
var exponent = new Array();
|
||||
exponent[0] = -Infinity;
|
||||
exponent[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
exponent[2] = -0.000000000000001;
|
||||
exponent[3] = 0.000000000000001;
|
||||
exponent[4] = 1.7976931348623157E308; //largest finite number
|
||||
exponent[5] = +Infinity;
|
||||
exponent[6] = NaN;
|
||||
var exponentnum = 7;
|
||||
|
||||
for (var i = 0; i < exponentnum; i++)
|
||||
{
|
||||
if (!isNaN(Math.pow(base,exponent[i])))
|
||||
{
|
||||
$ERROR("#1: isNaN(Math.pow(" + base + ", " + exponent[i] + ")) === false");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If abs(base) > 1 and exponent is +∞, the result is +∞.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = +Infinity;
|
||||
var base = new Array();
|
||||
base[0] = -Infinity;
|
||||
base[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
base[2] = -1.000000000000001;
|
||||
base[3] = 1.000000000000001;
|
||||
base[4] = 1.7976931348623157E308; //largest finite number
|
||||
base[5] = +Infinity;
|
||||
var basenum = 6;
|
||||
|
||||
for (var i = 0; i < basenum; i++)
|
||||
{
|
||||
if (Math.pow(base[i],exponent) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If abs(base) > 1 and exponent is −∞, the result is +0.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = -Infinity;
|
||||
var base = new Array();
|
||||
base[0] = -Infinity;
|
||||
base[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
base[2] = -1.000000000000001;
|
||||
base[3] = 1.000000000000001;
|
||||
base[4] = 1.7976931348623157E308; //largest finite number
|
||||
base[5] = +Infinity;
|
||||
var basenum = 6;
|
||||
|
||||
for (var i = 0; i < basenum; i++)
|
||||
{
|
||||
if (Math.pow(base[i],exponent) !== +0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If abs(base) is 1 and exponent is +∞, the result is NaN.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = +Infinity;
|
||||
var base = new Array();
|
||||
base[0] = -1;
|
||||
base[1] = 1
|
||||
var basenum = 2;
|
||||
|
||||
for (var i = 0; i < basenum; i++)
|
||||
{
|
||||
if (!isNaN(Math.pow(base[i],exponent)))
|
||||
{
|
||||
$ERROR("#1: isNaN(Math.pow(" + base[i] + ", " + exponent + ")) === false");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If abs(base) is 1 and exponent is −∞, the result is NaN.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = -Infinity;
|
||||
var base = new Array();
|
||||
base[0] = -1;
|
||||
base[1] = 1
|
||||
var basenum = 2;
|
||||
|
||||
for (var i = 0; i < basenum; i++)
|
||||
{
|
||||
if (!isNaN(Math.pow(base[i],exponent)))
|
||||
{
|
||||
$ERROR("#1: isNaN(Math.pow(" + base[i] + ", " + exponent + ")) === false");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: If abs(base) < 1 and exponent is +∞, the result is +0.
|
||||
id: sec-applying-the-exp-operator
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = +Infinity;
|
||||
var base = new Array();
|
||||
base[0] = 0.999999999999999;
|
||||
base[1] = 0.5;
|
||||
base[2] = +0;
|
||||
base[3] = -0;
|
||||
base[4] = -0.5;
|
||||
base[5] = -0.999999999999999;
|
||||
var basenum = 6;
|
||||
|
||||
for (var i = 0; i < basenum; i++)
|
||||
{
|
||||
if (Math.pow(base[i],exponent) !== +0)
|
||||
{
|
||||
$ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -2,18 +2,16 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 20.2.2.26
|
||||
id: sec-math.pow
|
||||
description: >
|
||||
Math.pow.length is 2.
|
||||
info: >
|
||||
Math.pow ( x, y )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects:
|
||||
Every built-in Function object, including constructors, has a length
|
||||
property whose value is an integer. Unless otherwise specified, this
|
||||
value is equal to the largest number of named arguments shown in the
|
||||
subclause headings for the function description, including optional
|
||||
parameters. However, rest parameters shown using the form “...name”
|
||||
parameters. However, rest parameters shown using the form "...name"
|
||||
are not included in the default argument count.
|
||||
|
||||
Unless otherwise specified, the length property of a built-in Function
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-math.pow
|
||||
description: >
|
||||
Math.pow ( base, exponent )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects:
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
verifyNotEnumerable(Math, "pow");
|
||||
verifyWritable(Math, "pow");
|
||||
verifyConfigurable(Math, "pow");
|
|
@ -2,11 +2,9 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 20.2.2.26
|
||||
id: sec-math.pow
|
||||
description: >
|
||||
Math.pow.name is "pow".
|
||||
info: >
|
||||
Math.pow ( x, y )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects:
|
||||
Every built-in Function object, including constructors, that is not
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If exponent is NaN, the result is NaN.
|
||||
---*/
|
||||
|
||||
var exponent = NaN;
|
||||
var bases = [];
|
||||
bases[0] = -Infinity;
|
||||
bases[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
bases[2] = -0.000000000000001;
|
||||
bases[3] = -0;
|
||||
bases[4] = +0
|
||||
bases[5] = 0.000000000000001;
|
||||
bases[6] = 1.7976931348623157E308; //largest finite number
|
||||
bases[7] = +Infinity;
|
||||
bases[8] = NaN;
|
||||
|
||||
|
||||
for (var i = 0; i < bases.length; i++) {
|
||||
if (!isNaN(bases[i] ** exponent)) {
|
||||
$ERROR("isNaN(" + bases[i] + " ** " + exponent + ") === false");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If abs(base) < 1 and exponent is −∞, the result is +∞.
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = -Infinity;
|
||||
var bases = [];
|
||||
bases[0] = 0.999999999999999;
|
||||
bases[1] = 0.5;
|
||||
bases[2] = +0;
|
||||
bases[3] = -0;
|
||||
bases[4] = -0.5;
|
||||
bases[5] = -0.999999999999999;
|
||||
|
||||
for (var i = 0; i < bases.length; i++) {
|
||||
if (Math.pow(bases[i], exponent) !== +Infinity) {
|
||||
$ERROR("(" + bases[i] + " ** " + exponent + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If base is +∞ and exponent > 0, the result is +∞.
|
||||
---*/
|
||||
|
||||
|
||||
var base = +Infinity;
|
||||
var exponents = [];
|
||||
exponents[3] = Infinity;
|
||||
exponents[2] = 1.7976931348623157E308; //largest (by module) finite number
|
||||
exponents[1] = 1;
|
||||
exponents[0] = 0.000000000000001;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if (base ** exponents[i] !== +Infinity) {
|
||||
$ERROR("(" + base + " ** " + exponents[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If base is +∞ and exponent < 0, the result is +0.
|
||||
---*/
|
||||
|
||||
|
||||
var base = +Infinity;
|
||||
var exponents = [];
|
||||
exponents[0] = -Infinity;
|
||||
exponents[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
exponents[2] = -1;
|
||||
exponents[3] = -0.000000000000001;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if ((base ** exponents[i]) !== +0) {
|
||||
$ERROR("(" + base + " ** " + exponents[i] + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If base is −∞ and exponent > 0 and exponent is an odd integer, the result is −∞.
|
||||
---*/
|
||||
|
||||
|
||||
var base = -Infinity;
|
||||
var exponents = [];
|
||||
exponents[0] = 1;
|
||||
exponents[1] = 111;
|
||||
exponents[2] = 111111;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if ((base ** exponents[i]) !== -Infinity) {
|
||||
$ERROR("(" + base + " ** " + exponents[i] + ") !== -Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If base is −∞ and exponent > 0 and exponent is not an odd integer, the result is +∞.
|
||||
---*/
|
||||
|
||||
|
||||
var base = -Infinity;
|
||||
var exponents = [];
|
||||
exponents[0] = 0.000000000000001;
|
||||
exponents[1] = 2;
|
||||
exponents[2] = Math.PI;
|
||||
exponents[3] = 1.7976931348623157E308; //largest finite number
|
||||
exponents[4] = +Infinity;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if ((base ** exponents[i]) !== +Infinity) {
|
||||
$ERROR("(" + base + " ** " + exponents[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If base is −∞ and exponent < 0 and exponent is an odd integer, the result is −0.
|
||||
---*/
|
||||
|
||||
|
||||
var base = -Infinity;
|
||||
var exponents = [];
|
||||
exponents[2] = -1;
|
||||
exponents[1] = -111;
|
||||
exponents[0] = -111111;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if ((base ** exponents[i]) !== -0) {
|
||||
$ERROR("(" + base + " ** " + exponents[i] + ") !== -0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If base is −∞ and exponent < 0 and exponent is not an odd integer, the result is +0.
|
||||
---*/
|
||||
|
||||
|
||||
var base = -Infinity;
|
||||
var exponents = [];
|
||||
exponents[4] = -0.000000000000001;
|
||||
exponents[3] = -2;
|
||||
exponents[2] = -Math.PI;
|
||||
exponents[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
exponents[0] = -Infinity;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if ((base ** exponents[i]) !== +0) {
|
||||
$ERROR("(" + base + " ** " + exponents[i] + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If base is +0 and exponent > 0, the result is +0.
|
||||
---*/
|
||||
|
||||
|
||||
var base = +0;
|
||||
var exponents = [];
|
||||
exponents[3] = Infinity;
|
||||
exponents[2] = 1.7976931348623157E308; //largest finite number
|
||||
exponents[1] = 1;
|
||||
exponents[0] = 0.000000000000001;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if ((base ** exponents[i]) !== +0) {
|
||||
$ERROR("(" + base + " ** " + exponents[i] + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If base is +0 and exponent < 0, the result is +∞.
|
||||
---*/
|
||||
|
||||
|
||||
var base = +0;
|
||||
var exponents = [];
|
||||
exponents[0] = -Infinity;
|
||||
exponents[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
exponents[2] = -1;
|
||||
exponents[3] = -0.000000000000001;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if ((base ** exponents[i]) !== +Infinity) {
|
||||
$ERROR("(" + base + " ** " + exponents[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If base is −0 and exponent > 0 and exponent is an odd integer, the result is −0.
|
||||
---*/
|
||||
|
||||
|
||||
var base = -0;
|
||||
var exponents = [];
|
||||
exponents[0] = 1;
|
||||
exponents[1] = 111;
|
||||
exponents[2] = 111111;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if ((base ** exponents[i]) !== -0) {
|
||||
$ERROR("(" + base + " ** " + exponents[i] + ") !== -0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: >
|
||||
If exponent is +0, the result is 1, even if base is NaN.
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = +0;
|
||||
var bases = [];
|
||||
bases[0] = -Infinity;
|
||||
bases[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
bases[2] = -0.000000000000001;
|
||||
bases[3] = -0;
|
||||
bases[4] = +0
|
||||
bases[5] = 0.000000000000001;
|
||||
bases[6] = 1.7976931348623157E308; //largest finite number
|
||||
bases[7] = +Infinity;
|
||||
bases[8] = NaN;
|
||||
|
||||
for (var i = 0; i < bases.length; i++) {
|
||||
if ((bases[i] ** exponent) !== 1) {
|
||||
$ERROR("(" + bases[i] + " ** " + exponent + ") !== 1");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If base is −0 and exponent > 0 and exponent is not an odd integer, the result is +0.
|
||||
---*/
|
||||
|
||||
|
||||
var base = -0;
|
||||
var exponents = [];
|
||||
exponents[0] = 0.000000000000001;
|
||||
exponents[1] = 2;
|
||||
exponents[2] = Math.PI;
|
||||
exponents[3] = 1.7976931348623157E308; //largest finite number
|
||||
exponents[4] = +Infinity;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if ((base ** exponents[i]) !== +0) {
|
||||
$ERROR("(" + base + " ** " + exponents[i] + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If base is −0 and exponent < 0 and exponent is an odd integer, the result is −∞.
|
||||
---*/
|
||||
|
||||
|
||||
var base = -0;
|
||||
var exponents = [];
|
||||
exponents[2] = -1;
|
||||
exponents[1] = -111;
|
||||
exponents[0] = -111111;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if ((base ** exponents[i]) !== -Infinity) {
|
||||
$ERROR("(" + base + " ** " + exponents[i] + ") !== -Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If base is −0 and exponent < 0 and exponent is not an odd integer, the result is +∞.
|
||||
---*/
|
||||
|
||||
|
||||
var base = -0;
|
||||
var exponents = [];
|
||||
exponents[4] = -0.000000000000001;
|
||||
exponents[3] = -2;
|
||||
exponents[2] = -Math.PI;
|
||||
exponents[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
exponents[0] = -Infinity;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if ((base ** exponents[i]) !== +Infinity) {
|
||||
$ERROR("(" + base + " ** " + exponents[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If base < 0 and base is finite and exponent is finite and exponent is not an integer, the result is NaN.
|
||||
---*/
|
||||
|
||||
|
||||
var exponents = [];
|
||||
var bases = [];
|
||||
bases[0] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
bases[1] = -Math.PI;
|
||||
bases[2] = -1;
|
||||
bases[3] = -0.000000000000001;
|
||||
|
||||
exponents[0] = -Math.PI;
|
||||
exponents[1] = -Math.E;
|
||||
exponents[2] = -1.000000000000001;
|
||||
exponents[3] = -0.000000000000001;
|
||||
exponents[4] = 0.000000000000001;
|
||||
exponents[5] = 1.000000000000001;
|
||||
exponents[6] = Math.E;
|
||||
exponents[7] = Math.PI;
|
||||
|
||||
for (var i = 0; i < bases.length; i++) {
|
||||
for (var j = 0; j < exponents.length; j++) {
|
||||
if (!isNaN(bases[i] ** exponents[j])) {
|
||||
$ERROR("isNaN(" + bases[i] + " ** " + exponents[j] + ") === false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,225 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: >
|
||||
Checking if Math.pow(argument1, argument2) is approximately equals
|
||||
to its mathematical value on the set of 64 argument1 values and 64
|
||||
argument2 values; all the sample values is calculated with LibC
|
||||
includes:
|
||||
- math_precision.js
|
||||
- math_isequal.js
|
||||
---*/
|
||||
|
||||
var vnum = 64;
|
||||
var base1 = [];
|
||||
base1[0] = 0.00000000000000000000;
|
||||
base1[1] = 0.25396825396825395000;
|
||||
base1[2] = 0.50793650793650791000;
|
||||
base1[3] = 0.76190476190476186000;
|
||||
base1[4] = 1.01587301587301580000;
|
||||
base1[5] = 1.26984126984126980000;
|
||||
base1[6] = 1.52380952380952370000;
|
||||
base1[7] = 1.77777777777777770000;
|
||||
base1[8] = 2.03174603174603160000;
|
||||
base1[9] = 2.28571428571428560000;
|
||||
base1[10] = 2.53968253968253950000;
|
||||
base1[11] = 2.79365079365079350000;
|
||||
base1[12] = 3.04761904761904740000;
|
||||
base1[13] = 3.30158730158730140000;
|
||||
base1[14] = 3.55555555555555540000;
|
||||
base1[15] = 3.80952380952380930000;
|
||||
base1[16] = 4.06349206349206330000;
|
||||
base1[17] = 4.31746031746031720000;
|
||||
base1[18] = 4.57142857142857120000;
|
||||
base1[19] = 4.82539682539682510000;
|
||||
base1[20] = 5.07936507936507910000;
|
||||
base1[21] = 5.33333333333333300000;
|
||||
base1[22] = 5.58730158730158700000;
|
||||
base1[23] = 5.84126984126984090000;
|
||||
base1[24] = 6.09523809523809490000;
|
||||
base1[25] = 6.34920634920634890000;
|
||||
base1[26] = 6.60317460317460280000;
|
||||
base1[27] = 6.85714285714285680000;
|
||||
base1[28] = 7.11111111111111070000;
|
||||
base1[29] = 7.36507936507936470000;
|
||||
base1[30] = 7.61904761904761860000;
|
||||
base1[31] = 7.87301587301587260000;
|
||||
base1[32] = 8.12698412698412650000;
|
||||
base1[33] = 8.38095238095238140000;
|
||||
base1[34] = 8.63492063492063440000;
|
||||
base1[35] = 8.88888888888888930000;
|
||||
base1[36] = 9.14285714285714230000;
|
||||
base1[37] = 9.39682539682539720000;
|
||||
base1[38] = 9.65079365079365030000;
|
||||
base1[39] = 9.90476190476190510000;
|
||||
base1[40] = 10.15873015873015800000;
|
||||
base1[41] = 10.41269841269841300000;
|
||||
base1[42] = 10.66666666666666600000;
|
||||
base1[43] = 10.92063492063492100000;
|
||||
base1[44] = 11.17460317460317400000;
|
||||
base1[45] = 11.42857142857142900000;
|
||||
base1[46] = 11.68253968253968200000;
|
||||
base1[47] = 11.93650793650793700000;
|
||||
base1[48] = 12.19047619047619000000;
|
||||
base1[49] = 12.44444444444444500000;
|
||||
base1[50] = 12.69841269841269800000;
|
||||
base1[51] = 12.95238095238095300000;
|
||||
base1[52] = 13.20634920634920600000;
|
||||
base1[53] = 13.46031746031746000000;
|
||||
base1[54] = 13.71428571428571400000;
|
||||
base1[55] = 13.96825396825396800000;
|
||||
base1[56] = 14.22222222222222100000;
|
||||
base1[57] = 14.47619047619047600000;
|
||||
base1[58] = 14.73015873015872900000;
|
||||
base1[59] = 14.98412698412698400000;
|
||||
base1[60] = 15.23809523809523700000;
|
||||
base1[61] = 15.49206349206349200000;
|
||||
base1[62] = 15.74603174603174500000;
|
||||
base1[63] = 16.00000000000000000000;
|
||||
|
||||
|
||||
|
||||
var base2 = [];
|
||||
base2[0] = -16.00000000000000000000;
|
||||
base2[1] = -15.49206349206349200000;
|
||||
base2[2] = -14.98412698412698400000;
|
||||
base2[3] = -14.47619047619047600000;
|
||||
base2[4] = -13.96825396825396800000;
|
||||
base2[5] = -13.46031746031746000000;
|
||||
base2[6] = -12.95238095238095300000;
|
||||
base2[7] = -12.44444444444444500000;
|
||||
base2[8] = -11.93650793650793700000;
|
||||
base2[9] = -11.42857142857142900000;
|
||||
base2[10] = -10.92063492063492100000;
|
||||
base2[11] = -10.41269841269841300000;
|
||||
base2[12] = -9.90476190476190510000;
|
||||
base2[13] = -9.39682539682539720000;
|
||||
base2[14] = -8.88888888888888930000;
|
||||
base2[15] = -8.38095238095238140000;
|
||||
base2[16] = -7.87301587301587350000;
|
||||
base2[17] = -7.36507936507936560000;
|
||||
base2[18] = -6.85714285714285770000;
|
||||
base2[19] = -6.34920634920634970000;
|
||||
base2[20] = -5.84126984126984180000;
|
||||
base2[21] = -5.33333333333333390000;
|
||||
base2[22] = -4.82539682539682600000;
|
||||
base2[23] = -4.31746031746031810000;
|
||||
base2[24] = -3.80952380952381020000;
|
||||
base2[25] = -3.30158730158730230000;
|
||||
base2[26] = -2.79365079365079440000;
|
||||
base2[27] = -2.28571428571428650000;
|
||||
base2[28] = -1.77777777777777860000;
|
||||
base2[29] = -1.26984126984127070000;
|
||||
base2[30] = -0.76190476190476275000;
|
||||
base2[31] = -0.25396825396825484000;
|
||||
base2[32] = 0.25396825396825307000;
|
||||
base2[33] = 0.76190476190476275000;
|
||||
base2[34] = 1.26984126984126890000;
|
||||
base2[35] = 1.77777777777777860000;
|
||||
base2[36] = 2.28571428571428470000;
|
||||
base2[37] = 2.79365079365079440000;
|
||||
base2[38] = 3.30158730158730050000;
|
||||
base2[39] = 3.80952380952381020000;
|
||||
base2[40] = 4.31746031746031630000;
|
||||
base2[41] = 4.82539682539682600000;
|
||||
base2[42] = 5.33333333333333210000;
|
||||
base2[43] = 5.84126984126984180000;
|
||||
base2[44] = 6.34920634920634800000;
|
||||
base2[45] = 6.85714285714285770000;
|
||||
base2[46] = 7.36507936507936380000;
|
||||
base2[47] = 7.87301587301587350000;
|
||||
base2[48] = 8.38095238095237960000;
|
||||
base2[49] = 8.88888888888888930000;
|
||||
base2[50] = 9.39682539682539540000;
|
||||
base2[51] = 9.90476190476190510000;
|
||||
base2[52] = 10.41269841269841100000;
|
||||
base2[53] = 10.92063492063492100000;
|
||||
base2[54] = 11.42857142857142700000;
|
||||
base2[55] = 11.93650793650793700000;
|
||||
base2[56] = 12.44444444444444300000;
|
||||
base2[57] = 12.95238095238095300000;
|
||||
base2[58] = 13.46031746031745900000;
|
||||
base2[59] = 13.96825396825396800000;
|
||||
base2[60] = 14.47619047619047400000;
|
||||
base2[61] = 14.98412698412698400000;
|
||||
base2[62] = 15.49206349206349000000;
|
||||
base2[63] = 16.00000000000000000000;
|
||||
|
||||
|
||||
var exponents = [];
|
||||
exponents[0] = +Infinity;
|
||||
exponents[1] = 1664158979.11096290000000000000;
|
||||
exponents[2] = 25596.98862206424700000000;
|
||||
exponents[3] = 51.24224360332205900000;
|
||||
exponents[4] = 0.80253721621001273000;
|
||||
exponents[5] = 0.04013281604184240600;
|
||||
exponents[6] = 0.00427181167466968250;
|
||||
exponents[7] = 0.00077698684629307839;
|
||||
exponents[8] = 0.00021140449751288852;
|
||||
exponents[9] = 0.00007886641216275820;
|
||||
exponents[10] = 0.00003797970495625904;
|
||||
exponents[11] = 0.00002260186576944384;
|
||||
exponents[12] = 0.00001608735704675994;
|
||||
exponents[13] = 0.00001335526639440840;
|
||||
exponents[14] = 0.00001267782407825002;
|
||||
exponents[15] = 0.00001354410739307298;
|
||||
exponents[16] = 0.00001607404700077214;
|
||||
exponents[17] = 0.00002096489798949858;
|
||||
exponents[18] = 0.00002978033411316872;
|
||||
exponents[19] = 0.00004572015769326707;
|
||||
exponents[20] = 0.00007536620884896827;
|
||||
exponents[21] = 0.00013263967558882687;
|
||||
exponents[22] = 0.00024800091950917796;
|
||||
exponents[23] = 0.00049049578772052680;
|
||||
exponents[24] = 0.00102225521238885490;
|
||||
exponents[25] = 0.00223744147356661880;
|
||||
exponents[26] = 0.00512739755878587920;
|
||||
exponents[27] = 0.01226918030754863000;
|
||||
exponents[28] = 0.03058049475427409400;
|
||||
exponents[29] = 0.07921771472569966200;
|
||||
exponents[30] = 0.21285098601167457000;
|
||||
exponents[31] = 0.59211846233860321000;
|
||||
exponents[32] = 1.70252376919407730000;
|
||||
exponents[33] = 5.05197994186350920000;
|
||||
exponents[34] = 15.44896866758827700000;
|
||||
exponents[35] = 48.62279949816147700000;
|
||||
exponents[36] = 157.31086033139039000000;
|
||||
exponents[37] = 522.60021277476767000000;
|
||||
exponents[38] = 1780.82316713426990000000;
|
||||
exponents[39] = 6218.58509846337710000000;
|
||||
exponents[40] = 22232.54916898025500000000;
|
||||
exponents[41] = 81310.50695814844200000000;
|
||||
exponents[42] = 303962.39599994919000000000;
|
||||
exponents[43] = 1160609.39151835810000000000;
|
||||
exponents[44] = 4523160.16396183520000000000;
|
||||
exponents[45] = 17980506.53105686600000000000;
|
||||
exponents[46] = 72861260.63140085300000000000;
|
||||
exponents[47] = 300795965.18372804000000000000;
|
||||
exponents[48] = 1264408843.88636260000000000000;
|
||||
exponents[49] = 5408983705.82595920000000000000;
|
||||
exponents[50] = 23536438485.32324600000000000000;
|
||||
exponents[51] = 104125724201.77888000000000000000;
|
||||
exponents[52] = 468137079409.17462000000000000000;
|
||||
exponents[53] = 2137965865913.91260000000000000000;
|
||||
exponents[54] = 9914368643808.25200000000000000000;
|
||||
exponents[55] = 46665726995317.89800000000000000000;
|
||||
exponents[56] = 222863786409039.87000000000000000000;
|
||||
exponents[57] = 1079534443702065.00000000000000000000;
|
||||
exponents[58] = 5302037850329952.00000000000000000000;
|
||||
exponents[59] = 26394813313751084.00000000000000000000;
|
||||
exponents[60] = 133146543235024720.00000000000000000000;
|
||||
exponents[61] = 680375082351885950.00000000000000000000;
|
||||
exponents[62] = 3520878542447823900.00000000000000000000;
|
||||
exponents[63] = 18446744073709552000.00000000000000000000;
|
||||
|
||||
|
||||
|
||||
var val;
|
||||
for (var i = 0; i < vnum; i++) {
|
||||
val = base1[i] ** base2[i];
|
||||
if (!isEqual(val, exponents[i])) {
|
||||
$ERROR("\nx1 = " + base1[i] + "\nx2 = " + base2[i] + "\nlibc.pow(x1,x2) = " + exponents[i] + "\n(x1 ** base2) = " + (base1[i] ** base2[i]) + "\nMath.abs(libc.pow(x1,x2) - (x1 ** base2)) > " + prec + "\n\n");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: >
|
||||
If exponent is −0, the result is 1, even if base is NaN.
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = -0;
|
||||
var bases = [];
|
||||
bases[0] = -Infinity;
|
||||
bases[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
bases[2] = -0.000000000000001;
|
||||
bases[3] = -0;
|
||||
bases[4] = +0
|
||||
bases[5] = 0.000000000000001;
|
||||
bases[6] = 1.7976931348623157E308; //largest finite number
|
||||
bases[7] = +Infinity;
|
||||
bases[8] = NaN;
|
||||
|
||||
for (var i = 0; i < bases.length; i++) {
|
||||
if ((bases[i] ** exponent) !== 1) {
|
||||
$ERROR("(" + bases[i] + " ** -0) !== 1");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: 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++) {
|
||||
if (!isNaN(base ** exponents[i])) {
|
||||
$ERROR("isNaN(" + base + " ** " + exponents[i] + ") === false");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If abs(base) > 1 and exponent is +∞, the result is +∞.
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = +Infinity;
|
||||
var bases = [];
|
||||
bases[0] = -Infinity;
|
||||
bases[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
bases[2] = -1.000000000000001;
|
||||
bases[3] = 1.000000000000001;
|
||||
bases[4] = 1.7976931348623157E308; //largest finite number
|
||||
bases[5] = +Infinity;
|
||||
|
||||
for (var i = 0; i < bases.length; i++) {
|
||||
if ((bases[i] ** exponent) !== +Infinity) {
|
||||
$ERROR("(" + bases[i] + " ** " + exponent + ") !== +Infinity");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If abs(base) > 1 and exponent is −∞, the result is +0.
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = -Infinity;
|
||||
var bases = [];
|
||||
bases[0] = -Infinity;
|
||||
bases[1] = -1.7976931348623157E308; //largest (by module) finite number
|
||||
bases[2] = -1.000000000000001;
|
||||
bases[3] = 1.000000000000001;
|
||||
bases[4] = 1.7976931348623157E308; //largest finite number
|
||||
bases[5] = +Infinity;
|
||||
|
||||
for (var i = 0; i < bases.length; i++) {
|
||||
if ((bases[i] ** exponent) !== +0) {
|
||||
$ERROR("(" + bases[i] + " ** " + exponent + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If abs(base) is 1 and exponent is +∞, the result is NaN.
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = +Infinity;
|
||||
var bases = [];
|
||||
bases[0] = -1;
|
||||
bases[1] = 1
|
||||
|
||||
for (var i = 0; i < bases.length; i++) {
|
||||
if (!isNaN(bases[i] ** exponent)) {
|
||||
$ERROR("isNaN(" + bases[i] + " ** " + exponent + ") === false");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If abs(base) is 1 and exponent is −∞, the result is NaN.
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = -Infinity;
|
||||
var bases = [];
|
||||
bases[0] = -1;
|
||||
bases[1] = 1
|
||||
|
||||
for (var i = 0; i < bases.length; i++) {
|
||||
if (!isNaN(bases[i] ** exponent)) {
|
||||
$ERROR("isNaN(" + bases[i] + " ** " + exponent + ") === false");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-applying-the-exp-operator
|
||||
description: If abs(base) < 1 and exponent is +∞, the result is +0.
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
var exponent = +Infinity;
|
||||
var bases = [];
|
||||
bases[0] = 0.999999999999999;
|
||||
bases[1] = 0.5;
|
||||
bases[2] = +0;
|
||||
bases[3] = -0;
|
||||
bases[4] = -0.5;
|
||||
bases[5] = -0.999999999999999;
|
||||
|
||||
for (var i = 0; i < bases.length; i++) {
|
||||
if ((bases[i] ** exponent) !== +0) {
|
||||
$ERROR("(" + bases[i] + " ** " + exponent + ") !== +0");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
author: Rick Waldron
|
||||
id: sec-assignment-operators-runtime-semantics-evaluation
|
||||
description: >
|
||||
AssignmentExpression:
|
||||
LeftHandSideExpression AssignmentOperator AssignmentExpression
|
||||
|
||||
1. Let lref be the result of evaluating LeftHandSideExpression.
|
||||
2. Let lval be ? GetValue(lref).
|
||||
3. Let rref be the result of evaluating AssignmentExpression.
|
||||
4. Let rval be ? GetValue(rref).
|
||||
5. Let op be the @ where AssignmentOperator is @=.
|
||||
6. Let r be the result of applying op to lval and rval as if evaluating the expression lval op rval.
|
||||
7. Perform ? PutValue(lref, r).
|
||||
8. Return r.
|
||||
|
||||
---*/
|
||||
|
||||
var base = -3;
|
||||
|
||||
assert.sameValue(base **= 3, -27, "(base **= 3) === -27; where base is -3");
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (C) 2016 Rick Waldron, André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
author: Rick Waldron, André Bargull
|
||||
id: sec-exp-operator-runtime-semantics-evaluation
|
||||
description: >
|
||||
ExponentiationExpression:
|
||||
UpdateExpression ** ExponentiationExpression
|
||||
|
||||
1. Let left be the result of evaluating UpdateExpression.
|
||||
2. Let leftValue be ? GetValue(left).
|
||||
3. Let right be the result of evaluating ExponentiationExpression.
|
||||
4. Let rightValue be ? GetValue(right).
|
||||
5. Let base be ? ToNumber(leftValue).
|
||||
6. Let exponent be ? ToNumber(rightValue).
|
||||
7. Return the result of Applying the ** operator with base and exponent as specified in 12.7.3.4.
|
||||
---*/
|
||||
|
||||
var capture = [];
|
||||
var leftValue = { valueOf() { capture.push("leftValue"); return 3; }};
|
||||
var rightValue = { valueOf() { capture.push("rightValue"); return 2; }};
|
||||
|
||||
(capture.push("left"), leftValue) ** (capture.push("right"), rightValue);
|
||||
|
||||
// Expected per operator evaluation order: "left", "right", "leftValue", "rightValue"
|
||||
|
||||
assert.sameValue(capture[0], "left", "Expected the 1st element captured to be 'left'");
|
||||
assert.sameValue(capture[1], "right", "Expected the 2nd element captured to be 'right'");
|
||||
assert.sameValue(capture[2], "leftValue", "Expected the 3rd element captured to be 'leftValue'");
|
||||
assert.sameValue(capture[3], "rightValue", "Expected the 4th element captured to be 'rightValue'");
|
|
@ -0,0 +1,63 @@
|
|||
// Copyright (C) 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
author: Rick Waldron
|
||||
id: sec-unary-operators
|
||||
description: >
|
||||
ExponentiationExpression :
|
||||
UnaryExpression
|
||||
...
|
||||
|
||||
UnaryExpression :
|
||||
...
|
||||
`delete` UnaryExpression
|
||||
`void` UnaryExpression
|
||||
`typeof` UnaryExpression
|
||||
`+` UnaryExpression
|
||||
`-` UnaryExpression
|
||||
`~` UnaryExpression
|
||||
`!` UnaryExpression
|
||||
---*/
|
||||
|
||||
assert.sameValue(-(3 ** 2), -9, "-(3 ** 2) === -9");
|
||||
assert.sameValue(+(3 ** 2), 9, "+(3 ** 2) === 9");
|
||||
assert.sameValue(~(3 ** 2), -10, "~(3 ** 2) === -10");
|
||||
assert.sameValue(!(3 ** 2), false, "!(3 ** 2) === false");
|
||||
|
||||
|
||||
assert.sameValue(2 ** -2, 0.25);
|
||||
|
||||
var o = { p: 1 };
|
||||
|
||||
assert.sameValue(2 ** delete o.p, 2, "delete o.p -> true -> ToNumber(true) -> 1");
|
||||
assert.sameValue(2 ** void 1, NaN, "void 1 -> undefined -> ToNumber(undefined) -> NaN");
|
||||
assert.sameValue(2 ** typeof 1, NaN, "typeof 1 -> 'number' -> ToNumber('number') -> NaN");
|
||||
|
||||
var s = "2";
|
||||
var n = 2;
|
||||
|
||||
assert.sameValue(2 ** +s, 4, "+s -> +'2' -> 2 -> ToNumber(2) -> 2");
|
||||
assert.sameValue(2 ** +n, 4, "+s -> +2 -> 2 -> ToNumber(2) -> 2");
|
||||
|
||||
assert.sameValue(2 ** -s, 0.25, "-s -> -'2' -> -2 -> ToNumber(-2) -> -2");
|
||||
assert.sameValue(2 ** -n, 0.25, "-s -> -2 -> -2 -> ToNumber(-2) -> -2");
|
||||
|
||||
assert.sameValue(2 ** ~s, 0.125, "~s -> ~'2' -> -3 -> ToNumber(-3) -> -3");
|
||||
assert.sameValue(2 ** ~n, 0.125, "~s -> ~2 -> -3 -> ToNumber(-3) -> -3");
|
||||
|
||||
assert.sameValue(2 ** !s, 1, "!s -> !'2' -> false -> ToNumber(false) -> 0");
|
||||
assert.sameValue(2 ** !n, 1, "!s -> !2 -> false -> ToNumber(false) -> 0");
|
||||
|
||||
|
||||
var capture = [];
|
||||
|
||||
(capture.push("left"), leftValue) ** +(capture.push("right"), rightValue);
|
||||
// ^
|
||||
// Changes the order
|
||||
|
||||
// Expected per operator evaluation order: "left", "right", "rightValue", "leftValue"
|
||||
assert.sameValue(capture[0], "left", "Expected the 1st element captured to be 'left'");
|
||||
assert.sameValue(capture[1], "right", "Expected the 2nd element captured to be 'right'");
|
||||
assert.sameValue(capture[2], "rightValue", "Expected the 3rd element captured to be 'rightValue'");
|
||||
assert.sameValue(capture[3], "leftValue", "Expected the 4th element captured to be 'leftValue'");
|
|
@ -0,0 +1,56 @@
|
|||
// Copyright (C) 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
author: Rick Waldron
|
||||
id: sec-update-expressions
|
||||
description: >
|
||||
ExponentiationExpression :
|
||||
...
|
||||
UpdateExpression `**` ExponentiationExpression
|
||||
|
||||
UpdateExpression :
|
||||
LeftHandSideExpression `++`
|
||||
LeftHandSideExpression `--`
|
||||
`++` UnaryExpression
|
||||
`--` UnaryExpression
|
||||
---*/
|
||||
|
||||
var base = 4;
|
||||
assert.sameValue(--base ** 2, 9, "(--base ** 2) === 9");
|
||||
assert.sameValue(++base ** 2, 16, "(++base ** 2) === 16");
|
||||
assert.sameValue(base++ ** 2, 16, "(base++ ** 2) === 16");
|
||||
assert.sameValue(base-- ** 2, 25, "(base-- ** 2) === 25");
|
||||
|
||||
base = 4;
|
||||
|
||||
// --base ** --base ** 2 -> 3 ** 2 ** 2 -> 3 ** (2 ** 2) -> 81
|
||||
assert.sameValue(
|
||||
--base ** --base ** 2,
|
||||
Math.pow(3, Math.pow(2, 2)),
|
||||
"(--base ** --base ** 2) === Math.pow(3, Math.pow(2, 2))"
|
||||
);
|
||||
|
||||
// ++base ** ++base ** 2 -> 3 ** 4 ** 2 -> 3 ** (4 ** 2) -> 43046721
|
||||
assert.sameValue(
|
||||
++base ** ++base ** 2,
|
||||
Math.pow(3, Math.pow(4, 2)),
|
||||
"(++base ** ++base ** 2) === Math.pow(3, Math.pow(4, 2))"
|
||||
);
|
||||
|
||||
base = 4;
|
||||
|
||||
// base-- ** base-- ** 2 -> 4 ** 3 ** 2 -> 4 ** (3 ** 2) -> 262144
|
||||
assert.sameValue(
|
||||
base-- ** base-- ** 2,
|
||||
Math.pow(4, Math.pow(3, 2)),
|
||||
"(base-- ** base-- ** 2) === Math.pow(4, Math.pow(3, 2))"
|
||||
);
|
||||
|
||||
// base++ ** base++ ** 2 -> 2 ** 3 ** 2 -> 2 ** (3 ** 2) -> 262144
|
||||
assert.sameValue(
|
||||
base++ ** base++ ** 2,
|
||||
Math.pow(2, Math.pow(3, 2)),
|
||||
"(base++ ** base++ ** 2) === Math.pow(2, Math.pow(3, 2))"
|
||||
);
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
author: Rick Waldron
|
||||
id: sec-unary-operators
|
||||
description: >
|
||||
ExponentiationExpression :
|
||||
UnaryExpression
|
||||
...
|
||||
|
||||
UnaryExpression :
|
||||
...
|
||||
`~` UnaryExpression
|
||||
...
|
||||
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
~3 ** 2;
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
author: Rick Waldron
|
||||
id: sec-unary-operators
|
||||
description: >
|
||||
ExponentiationExpression :
|
||||
UnaryExpression
|
||||
...
|
||||
|
||||
UnaryExpression :
|
||||
...
|
||||
`delete` UnaryExpression
|
||||
...
|
||||
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
delete o.p ** 2;
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
author: Rick Waldron
|
||||
id: sec-unary-operators
|
||||
description: >
|
||||
ExponentiationExpression :
|
||||
UnaryExpression
|
||||
...
|
||||
|
||||
UnaryExpression :
|
||||
...
|
||||
`!` UnaryExpression
|
||||
...
|
||||
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
!1 ** 2;
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
author: Rick Waldron
|
||||
id: sec-unary-operators
|
||||
description: >
|
||||
ExponentiationExpression :
|
||||
UnaryExpression
|
||||
...
|
||||
|
||||
UnaryExpression :
|
||||
...
|
||||
`-` UnaryExpression
|
||||
...
|
||||
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
-3 ** 2;
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
author: Rick Waldron
|
||||
id: sec-unary-operators
|
||||
description: >
|
||||
ExponentiationExpression :
|
||||
UnaryExpression
|
||||
...
|
||||
|
||||
UnaryExpression :
|
||||
...
|
||||
`+` UnaryExpression
|
||||
...
|
||||
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
+1 ** 2;
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
author: Rick Waldron
|
||||
id: sec-unary-operators
|
||||
description: >
|
||||
ExponentiationExpression :
|
||||
UnaryExpression
|
||||
...
|
||||
|
||||
UnaryExpression :
|
||||
...
|
||||
`typeof` UnaryExpression
|
||||
...
|
||||
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
typeof 1 ** 2;
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
author: Rick Waldron
|
||||
id: sec-unary-operators
|
||||
description: >
|
||||
ExponentiationExpression :
|
||||
UnaryExpression
|
||||
...
|
||||
|
||||
UnaryExpression :
|
||||
...
|
||||
`void` UnaryExpression
|
||||
...
|
||||
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
void 1 ** 2;
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2016 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
author: Rick Waldron
|
||||
id: sec-exp-operator
|
||||
description: >
|
||||
Performs exponential calculation on operands. Same algorithm as %MathPow%(base, exponent)
|
||||
---*/
|
||||
|
||||
var exponent = 2;
|
||||
assert.sameValue(2 ** 3, 8, "(2 ** 3) === 8");
|
||||
assert.sameValue(3 * 2 ** 3, 24, "(3 * 2 ** 3) === 24");
|
||||
assert.sameValue(2 ** ++exponent, 8, "(2 ** ++exponent) === 8");
|
||||
assert.sameValue(2 ** -1 * 2, 1, "(2 ** -1 * 2) === 1");
|
||||
assert.sameValue(2 ** 2 * 4, 16, "(2 ** 2 * 4) === 16");
|
||||
assert.sameValue(2 ** 2 / 2, 2, "(2 ** 2 / 2) === 2");
|
||||
assert.sameValue(2 ** (3 ** 2), 512, "(2 ** (3 ** 2)) === 512");
|
||||
assert.sameValue(2 ** 3 ** 2, 512, "(2 ** 3 ** 2) === 512");
|
||||
assert.sameValue(16 / 2 ** 2, 4, "(16 / 2 ** 2) === 4");
|
Loading…
Reference in New Issue