From 2a112a3190cf0ea666eabb18167310f0c7e4855b Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Sat, 13 Dec 2014 19:01:34 -0500 Subject: [PATCH] Exponentiation Operator tests --- test/built-ins/Math/pow/S15.8.2.13_A1.js | 31 --- test/built-ins/Math/pow/S15.8.2.13_A10.js | 30 --- test/built-ins/Math/pow/S15.8.2.13_A11.js | 28 --- test/built-ins/Math/pow/S15.8.2.13_A12.js | 28 --- test/built-ins/Math/pow/S15.8.2.13_A13.js | 29 --- test/built-ins/Math/pow/S15.8.2.13_A14.js | 31 --- test/built-ins/Math/pow/S15.8.2.13_A15.js | 27 -- test/built-ins/Math/pow/S15.8.2.13_A16.js | 29 --- test/built-ins/Math/pow/S15.8.2.13_A17.js | 26 -- test/built-ins/Math/pow/S15.8.2.13_A18.js | 28 --- test/built-ins/Math/pow/S15.8.2.13_A19.js | 25 -- test/built-ins/Math/pow/S15.8.2.13_A2.js | 33 --- test/built-ins/Math/pow/S15.8.2.13_A20.js | 29 --- test/built-ins/Math/pow/S15.8.2.13_A21.js | 27 -- test/built-ins/Math/pow/S15.8.2.13_A22.js | 29 --- test/built-ins/Math/pow/S15.8.2.13_A23.js | 37 --- test/built-ins/Math/pow/S15.8.2.13_A24.js | 231 ------------------ test/built-ins/Math/pow/S15.8.2.13_A3.js | 33 --- test/built-ins/Math/pow/S15.8.2.13_A4.js | 29 --- test/built-ins/Math/pow/S15.8.2.13_A5.js | 30 --- test/built-ins/Math/pow/S15.8.2.13_A6.js | 30 --- test/built-ins/Math/pow/S15.8.2.13_A7.js | 26 -- test/built-ins/Math/pow/S15.8.2.13_A8.js | 26 -- test/built-ins/Math/pow/S15.8.2.13_A9.js | 30 --- .../Math/pow/applying-the-exp-operator_A1.js | 29 +++ .../Math/pow/applying-the-exp-operator_A10.js | 26 ++ .../Math/pow/applying-the-exp-operator_A11.js | 24 ++ .../Math/pow/applying-the-exp-operator_A12.js | 24 ++ .../Math/pow/applying-the-exp-operator_A13.js | 23 ++ .../Math/pow/applying-the-exp-operator_A14.js | 25 ++ .../Math/pow/applying-the-exp-operator_A15.js | 23 ++ .../Math/pow/applying-the-exp-operator_A16.js | 25 ++ .../Math/pow/applying-the-exp-operator_A17.js | 24 ++ .../Math/pow/applying-the-exp-operator_A18.js | 24 ++ .../Math/pow/applying-the-exp-operator_A19.js | 23 ++ .../Math/pow/applying-the-exp-operator_A2.js | 29 +++ .../Math/pow/applying-the-exp-operator_A20.js | 25 ++ .../Math/pow/applying-the-exp-operator_A21.js | 23 ++ .../Math/pow/applying-the-exp-operator_A22.js | 25 ++ .../Math/pow/applying-the-exp-operator_A23.js | 32 +++ .../Math/pow/applying-the-exp-operator_A24.js | 227 +++++++++++++++++ .../Math/pow/applying-the-exp-operator_A3.js | 29 +++ .../Math/pow/applying-the-exp-operator_A4.js | 27 ++ .../Math/pow/applying-the-exp-operator_A5.js | 26 ++ .../Math/pow/applying-the-exp-operator_A6.js | 26 ++ .../Math/pow/applying-the-exp-operator_A7.js | 22 ++ .../Math/pow/applying-the-exp-operator_A8.js | 22 ++ .../Math/pow/applying-the-exp-operator_A9.js | 26 ++ test/built-ins/Math/pow/length.js | 6 +- test/built-ins/Math/pow/math.pow.js | 16 ++ test/built-ins/Math/pow/name.js | 4 +- .../applying-the-exp-operator_A1.js | 26 ++ .../applying-the-exp-operator_A10.js | 23 ++ .../applying-the-exp-operator_A11.js | 21 ++ .../applying-the-exp-operator_A12.js | 21 ++ .../applying-the-exp-operator_A13.js | 20 ++ .../applying-the-exp-operator_A14.js | 22 ++ .../applying-the-exp-operator_A15.js | 20 ++ .../applying-the-exp-operator_A16.js | 22 ++ .../applying-the-exp-operator_A17.js | 21 ++ .../applying-the-exp-operator_A18.js | 21 ++ .../applying-the-exp-operator_A19.js | 20 ++ .../applying-the-exp-operator_A2.js | 27 ++ .../applying-the-exp-operator_A20.js | 22 ++ .../applying-the-exp-operator_A21.js | 20 ++ .../applying-the-exp-operator_A22.js | 22 ++ .../applying-the-exp-operator_A23.js | 33 +++ .../applying-the-exp-operator_A24.js | 225 +++++++++++++++++ .../applying-the-exp-operator_A3.js | 27 ++ .../applying-the-exp-operator_A4.js | 24 ++ .../applying-the-exp-operator_A5.js | 23 ++ .../applying-the-exp-operator_A6.js | 23 ++ .../applying-the-exp-operator_A7.js | 19 ++ .../applying-the-exp-operator_A8.js | 19 ++ .../applying-the-exp-operator_A9.js | 24 ++ .../exponentiation/exp-assignment-operator.js | 24 ++ .../exp-operator-evaluation-order.js | 31 +++ ...r-precedence-unary-expression-semantics.js | 63 +++++ ...-precedence-update-expression-semantics.js | 56 +++++ ...ntax-error-bitnot-unary-expression-base.js | 19 ++ ...ntax-error-delete-unary-expression-base.js | 19 ++ ...error-logical-not-unary-expression-base.js | 19 ++ ...ntax-error-negate-unary-expression-base.js | 19 ++ ...syntax-error-plus-unary-expression-base.js | 19 ++ ...ntax-error-typeof-unary-expression-base.js | 19 ++ ...syntax-error-void-unary-expression-base.js | 19 ++ .../exponentiation/exp-operator.js | 20 ++ 87 files changed, 1900 insertions(+), 909 deletions(-) delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A1.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A10.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A11.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A12.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A13.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A14.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A15.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A16.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A17.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A18.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A19.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A2.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A20.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A21.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A22.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A23.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A24.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A3.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A4.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A5.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A6.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A7.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A8.js delete mode 100644 test/built-ins/Math/pow/S15.8.2.13_A9.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A1.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A10.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A11.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A12.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A13.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A14.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A15.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A16.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A17.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A18.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A19.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A2.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A20.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A21.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A22.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A23.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A24.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A3.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A4.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A5.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A6.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A7.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A8.js create mode 100644 test/built-ins/Math/pow/applying-the-exp-operator_A9.js create mode 100644 test/built-ins/Math/pow/math.pow.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A1.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A10.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A11.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A12.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A13.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A14.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A15.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A16.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A17.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A18.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A19.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A2.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A20.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A21.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A22.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A23.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A24.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A3.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A4.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A5.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A6.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A7.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A8.js create mode 100644 test/language/expressions/exponentiation/applying-the-exp-operator_A9.js create mode 100644 test/language/expressions/exponentiation/exp-assignment-operator.js create mode 100644 test/language/expressions/exponentiation/exp-operator-evaluation-order.js create mode 100644 test/language/expressions/exponentiation/exp-operator-precedence-unary-expression-semantics.js create mode 100644 test/language/expressions/exponentiation/exp-operator-precedence-update-expression-semantics.js create mode 100644 test/language/expressions/exponentiation/exp-operator-syntax-error-bitnot-unary-expression-base.js create mode 100644 test/language/expressions/exponentiation/exp-operator-syntax-error-delete-unary-expression-base.js create mode 100644 test/language/expressions/exponentiation/exp-operator-syntax-error-logical-not-unary-expression-base.js create mode 100644 test/language/expressions/exponentiation/exp-operator-syntax-error-negate-unary-expression-base.js create mode 100644 test/language/expressions/exponentiation/exp-operator-syntax-error-plus-unary-expression-base.js create mode 100644 test/language/expressions/exponentiation/exp-operator-syntax-error-typeof-unary-expression-base.js create mode 100644 test/language/expressions/exponentiation/exp-operator-syntax-error-void-unary-expression-base.js create mode 100644 test/language/expressions/exponentiation/exp-operator.js diff --git a/test/built-ins/Math/pow/S15.8.2.13_A1.js b/test/built-ins/Math/pow/S15.8.2.13_A1.js deleted file mode 100644 index 6bfae407f1..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A1.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A10.js b/test/built-ins/Math/pow/S15.8.2.13_A10.js deleted file mode 100644 index e1423a8c5c..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A10.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A11.js b/test/built-ins/Math/pow/S15.8.2.13_A11.js deleted file mode 100644 index c7e6d3bcd2..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A11.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A12.js b/test/built-ins/Math/pow/S15.8.2.13_A12.js deleted file mode 100644 index e380df55f6..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A12.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A13.js b/test/built-ins/Math/pow/S15.8.2.13_A13.js deleted file mode 100644 index f83ed7e398..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A13.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A14.js b/test/built-ins/Math/pow/S15.8.2.13_A14.js deleted file mode 100644 index 7166d636be..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A14.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A15.js b/test/built-ins/Math/pow/S15.8.2.13_A15.js deleted file mode 100644 index fe65c529c7..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A15.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A16.js b/test/built-ins/Math/pow/S15.8.2.13_A16.js deleted file mode 100644 index 9ffeaa3963..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A16.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A17.js b/test/built-ins/Math/pow/S15.8.2.13_A17.js deleted file mode 100644 index b57a3a565c..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A17.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A18.js b/test/built-ins/Math/pow/S15.8.2.13_A18.js deleted file mode 100644 index 7d33c9b09f..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A18.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A19.js b/test/built-ins/Math/pow/S15.8.2.13_A19.js deleted file mode 100644 index e86d3ca33c..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A19.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A2.js b/test/built-ins/Math/pow/S15.8.2.13_A2.js deleted file mode 100644 index d4d4276bde..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A2.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A20.js b/test/built-ins/Math/pow/S15.8.2.13_A20.js deleted file mode 100644 index a5f3981fd7..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A20.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A21.js b/test/built-ins/Math/pow/S15.8.2.13_A21.js deleted file mode 100644 index 65a201a27f..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A21.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A22.js b/test/built-ins/Math/pow/S15.8.2.13_A22.js deleted file mode 100644 index 748e2b04ef..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A22.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A23.js b/test/built-ins/Math/pow/S15.8.2.13_A23.js deleted file mode 100644 index 2249420912..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A23.js +++ /dev/null @@ -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"); diff --git a/test/built-ins/Math/pow/S15.8.2.13_A24.js b/test/built-ins/Math/pow/S15.8.2.13_A24.js deleted file mode 100644 index 74d7366b1b..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A24.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A3.js b/test/built-ins/Math/pow/S15.8.2.13_A3.js deleted file mode 100644 index 670be2f762..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A3.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A4.js b/test/built-ins/Math/pow/S15.8.2.13_A4.js deleted file mode 100644 index bd089d1c39..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A4.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A5.js b/test/built-ins/Math/pow/S15.8.2.13_A5.js deleted file mode 100644 index 4d74c16acc..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A5.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A6.js b/test/built-ins/Math/pow/S15.8.2.13_A6.js deleted file mode 100644 index 470e37a685..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A6.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A7.js b/test/built-ins/Math/pow/S15.8.2.13_A7.js deleted file mode 100644 index ba60268314..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A7.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A8.js b/test/built-ins/Math/pow/S15.8.2.13_A8.js deleted file mode 100644 index 78a0ef7715..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A8.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/S15.8.2.13_A9.js b/test/built-ins/Math/pow/S15.8.2.13_A9.js deleted file mode 100644 index 84fc30f10b..0000000000 --- a/test/built-ins/Math/pow/S15.8.2.13_A9.js +++ /dev/null @@ -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"); - } -} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A1.js b/test/built-ins/Math/pow/applying-the-exp-operator_A1.js new file mode 100644 index 0000000000..d254a9909b --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A1.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A10.js b/test/built-ins/Math/pow/applying-the-exp-operator_A10.js new file mode 100644 index 0000000000..b3bb64ad5e --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A10.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A11.js b/test/built-ins/Math/pow/applying-the-exp-operator_A11.js new file mode 100644 index 0000000000..2378117fa1 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A11.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A12.js b/test/built-ins/Math/pow/applying-the-exp-operator_A12.js new file mode 100644 index 0000000000..d5fa0935eb --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A12.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A13.js b/test/built-ins/Math/pow/applying-the-exp-operator_A13.js new file mode 100644 index 0000000000..3a3dbabf5f --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A13.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A14.js b/test/built-ins/Math/pow/applying-the-exp-operator_A14.js new file mode 100644 index 0000000000..79dbe86c12 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A14.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A15.js b/test/built-ins/Math/pow/applying-the-exp-operator_A15.js new file mode 100644 index 0000000000..e42ba1c2f6 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A15.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A16.js b/test/built-ins/Math/pow/applying-the-exp-operator_A16.js new file mode 100644 index 0000000000..c50a331255 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A16.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A17.js b/test/built-ins/Math/pow/applying-the-exp-operator_A17.js new file mode 100644 index 0000000000..3c18f248fa --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A17.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A18.js b/test/built-ins/Math/pow/applying-the-exp-operator_A18.js new file mode 100644 index 0000000000..6a4f81a3eb --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A18.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A19.js b/test/built-ins/Math/pow/applying-the-exp-operator_A19.js new file mode 100644 index 0000000000..b5dbdd74b7 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A19.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A2.js b/test/built-ins/Math/pow/applying-the-exp-operator_A2.js new file mode 100644 index 0000000000..c2e17dbe42 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A2.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A20.js b/test/built-ins/Math/pow/applying-the-exp-operator_A20.js new file mode 100644 index 0000000000..958b151090 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A20.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A21.js b/test/built-ins/Math/pow/applying-the-exp-operator_A21.js new file mode 100644 index 0000000000..5d49d68c33 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A21.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A22.js b/test/built-ins/Math/pow/applying-the-exp-operator_A22.js new file mode 100644 index 0000000000..5770a273f2 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A22.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A23.js b/test/built-ins/Math/pow/applying-the-exp-operator_A23.js new file mode 100644 index 0000000000..89d43d13b0 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A23.js @@ -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"); diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A24.js b/test/built-ins/Math/pow/applying-the-exp-operator_A24.js new file mode 100644 index 0000000000..d98f7100c9 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A24.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A3.js b/test/built-ins/Math/pow/applying-the-exp-operator_A3.js new file mode 100644 index 0000000000..7072551373 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A3.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A4.js b/test/built-ins/Math/pow/applying-the-exp-operator_A4.js new file mode 100644 index 0000000000..9de9fbcb0f --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A4.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A5.js b/test/built-ins/Math/pow/applying-the-exp-operator_A5.js new file mode 100644 index 0000000000..7112b87a6b --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A5.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A6.js b/test/built-ins/Math/pow/applying-the-exp-operator_A6.js new file mode 100644 index 0000000000..4a817e8e17 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A6.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A7.js b/test/built-ins/Math/pow/applying-the-exp-operator_A7.js new file mode 100644 index 0000000000..acaf474b96 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A7.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A8.js b/test/built-ins/Math/pow/applying-the-exp-operator_A8.js new file mode 100644 index 0000000000..4055f984a9 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A8.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A9.js b/test/built-ins/Math/pow/applying-the-exp-operator_A9.js new file mode 100644 index 0000000000..07f5b05584 --- /dev/null +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A9.js @@ -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"); + } +} diff --git a/test/built-ins/Math/pow/length.js b/test/built-ins/Math/pow/length.js index 7c893b6240..a73bcc1cbf 100755 --- a/test/built-ins/Math/pow/length.js +++ b/test/built-ins/Math/pow/length.js @@ -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 diff --git a/test/built-ins/Math/pow/math.pow.js b/test/built-ins/Math/pow/math.pow.js new file mode 100644 index 0000000000..373665f731 --- /dev/null +++ b/test/built-ins/Math/pow/math.pow.js @@ -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"); diff --git a/test/built-ins/Math/pow/name.js b/test/built-ins/Math/pow/name.js index 1657ad9094..e38d29eda7 100755 --- a/test/built-ins/Math/pow/name.js +++ b/test/built-ins/Math/pow/name.js @@ -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 diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A1.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A1.js new file mode 100644 index 0000000000..297c090b99 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A1.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A10.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A10.js new file mode 100644 index 0000000000..b3d7c7d5cf --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A10.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A11.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A11.js new file mode 100644 index 0000000000..93443094f8 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A11.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A12.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A12.js new file mode 100644 index 0000000000..77f08f8eef --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A12.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A13.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A13.js new file mode 100644 index 0000000000..f1a6f9dff5 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A13.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A14.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A14.js new file mode 100644 index 0000000000..47052e4a4c --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A14.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A15.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A15.js new file mode 100644 index 0000000000..d37d7f7a24 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A15.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A16.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A16.js new file mode 100644 index 0000000000..34d2d33fb4 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A16.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A17.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A17.js new file mode 100644 index 0000000000..7faf7c21e5 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A17.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A18.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A18.js new file mode 100644 index 0000000000..d2cb216740 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A18.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A19.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A19.js new file mode 100644 index 0000000000..29fbd09076 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A19.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A2.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A2.js new file mode 100644 index 0000000000..2fea956940 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A2.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A20.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A20.js new file mode 100644 index 0000000000..b07f17cccc --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A20.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A21.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A21.js new file mode 100644 index 0000000000..8487da3981 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A21.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A22.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A22.js new file mode 100644 index 0000000000..1ee77a970a --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A22.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A23.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A23.js new file mode 100644 index 0000000000..cd93496e84 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A23.js @@ -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"); + } + } +} + diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A24.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A24.js new file mode 100644 index 0000000000..24277c9690 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A24.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A3.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A3.js new file mode 100644 index 0000000000..8432a4ddea --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A3.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A4.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A4.js new file mode 100644 index 0000000000..43f0e303a3 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A4.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A5.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A5.js new file mode 100644 index 0000000000..d446f0160b --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A5.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A6.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A6.js new file mode 100644 index 0000000000..ded75c3d37 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A6.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A7.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A7.js new file mode 100644 index 0000000000..6ce24ea7e1 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A7.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A8.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A8.js new file mode 100644 index 0000000000..357f9eb4a2 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A8.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A9.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A9.js new file mode 100644 index 0000000000..a81d169784 --- /dev/null +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A9.js @@ -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"); + } +} diff --git a/test/language/expressions/exponentiation/exp-assignment-operator.js b/test/language/expressions/exponentiation/exp-assignment-operator.js new file mode 100644 index 0000000000..575fd1fd1d --- /dev/null +++ b/test/language/expressions/exponentiation/exp-assignment-operator.js @@ -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"); diff --git a/test/language/expressions/exponentiation/exp-operator-evaluation-order.js b/test/language/expressions/exponentiation/exp-operator-evaluation-order.js new file mode 100644 index 0000000000..ba7a87e8ae --- /dev/null +++ b/test/language/expressions/exponentiation/exp-operator-evaluation-order.js @@ -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'"); diff --git a/test/language/expressions/exponentiation/exp-operator-precedence-unary-expression-semantics.js b/test/language/expressions/exponentiation/exp-operator-precedence-unary-expression-semantics.js new file mode 100644 index 0000000000..2ae834a996 --- /dev/null +++ b/test/language/expressions/exponentiation/exp-operator-precedence-unary-expression-semantics.js @@ -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'"); diff --git a/test/language/expressions/exponentiation/exp-operator-precedence-update-expression-semantics.js b/test/language/expressions/exponentiation/exp-operator-precedence-update-expression-semantics.js new file mode 100644 index 0000000000..791fb36192 --- /dev/null +++ b/test/language/expressions/exponentiation/exp-operator-precedence-update-expression-semantics.js @@ -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))" +); + diff --git a/test/language/expressions/exponentiation/exp-operator-syntax-error-bitnot-unary-expression-base.js b/test/language/expressions/exponentiation/exp-operator-syntax-error-bitnot-unary-expression-base.js new file mode 100644 index 0000000000..de2c2c079d --- /dev/null +++ b/test/language/expressions/exponentiation/exp-operator-syntax-error-bitnot-unary-expression-base.js @@ -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; diff --git a/test/language/expressions/exponentiation/exp-operator-syntax-error-delete-unary-expression-base.js b/test/language/expressions/exponentiation/exp-operator-syntax-error-delete-unary-expression-base.js new file mode 100644 index 0000000000..7767c8dbda --- /dev/null +++ b/test/language/expressions/exponentiation/exp-operator-syntax-error-delete-unary-expression-base.js @@ -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; diff --git a/test/language/expressions/exponentiation/exp-operator-syntax-error-logical-not-unary-expression-base.js b/test/language/expressions/exponentiation/exp-operator-syntax-error-logical-not-unary-expression-base.js new file mode 100644 index 0000000000..d4fbeb3f90 --- /dev/null +++ b/test/language/expressions/exponentiation/exp-operator-syntax-error-logical-not-unary-expression-base.js @@ -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; diff --git a/test/language/expressions/exponentiation/exp-operator-syntax-error-negate-unary-expression-base.js b/test/language/expressions/exponentiation/exp-operator-syntax-error-negate-unary-expression-base.js new file mode 100644 index 0000000000..37feeb754f --- /dev/null +++ b/test/language/expressions/exponentiation/exp-operator-syntax-error-negate-unary-expression-base.js @@ -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; diff --git a/test/language/expressions/exponentiation/exp-operator-syntax-error-plus-unary-expression-base.js b/test/language/expressions/exponentiation/exp-operator-syntax-error-plus-unary-expression-base.js new file mode 100644 index 0000000000..4585e975fb --- /dev/null +++ b/test/language/expressions/exponentiation/exp-operator-syntax-error-plus-unary-expression-base.js @@ -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; diff --git a/test/language/expressions/exponentiation/exp-operator-syntax-error-typeof-unary-expression-base.js b/test/language/expressions/exponentiation/exp-operator-syntax-error-typeof-unary-expression-base.js new file mode 100644 index 0000000000..6c884af88b --- /dev/null +++ b/test/language/expressions/exponentiation/exp-operator-syntax-error-typeof-unary-expression-base.js @@ -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; diff --git a/test/language/expressions/exponentiation/exp-operator-syntax-error-void-unary-expression-base.js b/test/language/expressions/exponentiation/exp-operator-syntax-error-void-unary-expression-base.js new file mode 100644 index 0000000000..a362c64f3e --- /dev/null +++ b/test/language/expressions/exponentiation/exp-operator-syntax-error-void-unary-expression-base.js @@ -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; diff --git a/test/language/expressions/exponentiation/exp-operator.js b/test/language/expressions/exponentiation/exp-operator.js new file mode 100644 index 0000000000..c3b92c6116 --- /dev/null +++ b/test/language/expressions/exponentiation/exp-operator.js @@ -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");