summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Math
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/non262/Math')
-rw-r--r--js/src/tests/non262/Math/15.8.1.js97
-rw-r--r--js/src/tests/non262/Math/15.8.2.13.js350
-rw-r--r--js/src/tests/non262/Math/15.8.2.16.js96
-rw-r--r--js/src/tests/non262/Math/15.8.2.17.js181
-rw-r--r--js/src/tests/non262/Math/15.8.2.18.js111
-rw-r--r--js/src/tests/non262/Math/15.8.2.2.js120
-rw-r--r--js/src/tests/non262/Math/15.8.2.3.js122
-rw-r--r--js/src/tests/non262/Math/15.8.2.4.js121
-rw-r--r--js/src/tests/non262/Math/15.8.2.5.js209
-rw-r--r--js/src/tests/non262/Math/15.8.2.7.js247
-rw-r--r--js/src/tests/non262/Math/15.8.2.8.js84
-rw-r--r--js/src/tests/non262/Math/20.2.2.ToNumber.js112
-rw-r--r--js/src/tests/non262/Math/Pow.js117
-rw-r--r--js/src/tests/non262/Math/acosh-approx.js283
-rw-r--r--js/src/tests/non262/Math/acosh-exact.js26
-rw-r--r--js/src/tests/non262/Math/asinh-approx.js303
-rw-r--r--js/src/tests/non262/Math/asinh-exact.js19
-rw-r--r--js/src/tests/non262/Math/atanh-approx.js280
-rw-r--r--js/src/tests/non262/Math/atanh-exact.js35
-rw-r--r--js/src/tests/non262/Math/browser.js0
-rw-r--r--js/src/tests/non262/Math/cbrt-approx.js17
-rw-r--r--js/src/tests/non262/Math/cbrt-exact.js19
-rw-r--r--js/src/tests/non262/Math/clz32.js40
-rw-r--r--js/src/tests/non262/Math/cosh-approx.js276
-rw-r--r--js/src/tests/non262/Math/cosh-exact.js19
-rw-r--r--js/src/tests/non262/Math/exp-exact.js29
-rw-r--r--js/src/tests/non262/Math/expm1-approx.js62
-rw-r--r--js/src/tests/non262/Math/expm1-exact.js20
-rw-r--r--js/src/tests/non262/Math/expm1-monotonicity.js94
-rw-r--r--js/src/tests/non262/Math/fround.js81
-rw-r--r--js/src/tests/non262/Math/log10-approx.js9
-rw-r--r--js/src/tests/non262/Math/log10-exact.js30
-rw-r--r--js/src/tests/non262/Math/log1p-approx.js20
-rw-r--r--js/src/tests/non262/Math/log1p-exact.js29
-rw-r--r--js/src/tests/non262/Math/log2-approx.js8
-rw-r--r--js/src/tests/non262/Math/log2-exact.js30
-rw-r--r--js/src/tests/non262/Math/shell.js74
-rw-r--r--js/src/tests/non262/Math/sign.js34
-rw-r--r--js/src/tests/non262/Math/sinh-approx.js297
-rw-r--r--js/src/tests/non262/Math/sinh-exact.js19
-rw-r--r--js/src/tests/non262/Math/tanh-approx.js282
-rw-r--r--js/src/tests/non262/Math/tanh-exact.js19
-rw-r--r--js/src/tests/non262/Math/trunc.js50
43 files changed, 4471 insertions, 0 deletions
diff --git a/js/src/tests/non262/Math/15.8.1.js b/js/src/tests/non262/Math/15.8.1.js
new file mode 100644
index 0000000000..269b602e5d
--- /dev/null
+++ b/js/src/tests/non262/Math/15.8.1.js
@@ -0,0 +1,97 @@
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+/**
+ File Name: 15.8.1.js
+ ECMA Section: 15.8.1.js Value Properties of the Math Object
+ 15.8.1.1 E
+ 15.8.1.2 LN10
+ 15.8.1.3 LN2
+ 15.8.1.4 LOG2E
+ 15.8.1.5 LOG10E
+ 15.8.1.6 PI
+ 15.8.1.7 SQRT1_2
+ 15.8.1.8 SQRT2
+ Description: verify the values of some math constants
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+var SECTION = "15.8.1"
+ var TITLE = "Value Properties of the Math Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( "Math.E",
+ 2.7182818284590452354,
+ Math.E );
+
+new TestCase( "typeof Math.E",
+ "number",
+ typeof Math.E );
+
+new TestCase( "Math.LN10",
+ 2.302585092994046,
+ Math.LN10 );
+
+new TestCase( "typeof Math.LN10",
+ "number",
+ typeof Math.LN10 );
+
+new TestCase( "Math.LN2",
+ 0.6931471805599453,
+ Math.LN2 );
+
+new TestCase( "typeof Math.LN2",
+ "number",
+ typeof Math.LN2 );
+
+new TestCase( "Math.LOG2E",
+ 1.4426950408889634,
+ Math.LOG2E );
+
+new TestCase( "typeof Math.LOG2E",
+ "number",
+ typeof Math.LOG2E );
+
+new TestCase( "Math.LOG10E",
+ 0.4342944819032518,
+ Math.LOG10E);
+
+new TestCase( "typeof Math.LOG10E",
+ "number",
+ typeof Math.LOG10E);
+
+new TestCase( "Math.PI",
+ 3.14159265358979323846,
+ Math.PI );
+
+new TestCase( "typeof Math.PI",
+ "number",
+ typeof Math.PI );
+
+new TestCase( "Math.SQRT1_2",
+ 0.7071067811865476,
+ Math.SQRT1_2);
+
+new TestCase( "typeof Math.SQRT1_2",
+ "number",
+ typeof Math.SQRT1_2);
+
+new TestCase( "Math.SQRT2",
+ 1.4142135623730951,
+ Math.SQRT2 );
+
+new TestCase( "typeof Math.SQRT2",
+ "number",
+ typeof Math.SQRT2 );
+
+new TestCase( "var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS",
+ "",
+ eval("var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS") );
+
+test();
diff --git a/js/src/tests/non262/Math/15.8.2.13.js b/js/src/tests/non262/Math/15.8.2.13.js
new file mode 100644
index 0000000000..10eeca88ab
--- /dev/null
+++ b/js/src/tests/non262/Math/15.8.2.13.js
@@ -0,0 +1,350 @@
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+/**
+ File Name: 15.8.2.13.js
+ ECMA Section: 15.8.2.13 Math.pow(x, y)
+ Description: return an approximation to the result of x
+ to the power of y. there are many special cases;
+ refer to the spec.
+ Author: christine@netscape.com
+ Date: 9 july 1997
+*/
+
+var SECTION = "15.8.2.13";
+var TITLE = "Math.pow(x, y)";
+var BUGNUMBER="77141";
+
+printBugNumber(BUGNUMBER);
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase(
+ "Math.pow.length",
+ 2,
+ Math.pow.length );
+
+new TestCase(
+ "Math.pow()",
+ Number.NaN,
+ Math.pow() );
+
+new TestCase(
+ "Math.pow(null, null)",
+ 1,
+ Math.pow(null,null) );
+
+new TestCase(
+ "Math.pow(void 0, void 0)",
+ Number.NaN,
+ Math.pow(void 0, void 0));
+
+new TestCase(
+ "Math.pow(true, false)",
+ 1,
+ Math.pow(true, false) );
+
+new TestCase(
+ "Math.pow(false,true)",
+ 0,
+ Math.pow(false,true) );
+
+new TestCase(
+ "Math.pow('2','32')",
+ 4294967296,
+ Math.pow('2','32') );
+
+new TestCase(
+ "Math.pow(1,NaN)",
+ Number.NaN,
+ Math.pow(1,Number.NaN) );
+
+new TestCase(
+ "Math.pow(0,NaN)",
+ Number.NaN,
+ Math.pow(0,Number.NaN) );
+
+new TestCase(
+ "Math.pow(NaN,0)",
+ 1,
+ Math.pow(Number.NaN,0) );
+
+new TestCase(
+ "Math.pow(NaN,-0)",
+ 1,
+ Math.pow(Number.NaN,-0) );
+
+new TestCase(
+ "Math.pow(NaN,1)",
+ Number.NaN,
+ Math.pow(Number.NaN, 1) );
+
+new TestCase(
+ "Math.pow(NaN,.5)",
+ Number.NaN,
+ Math.pow(Number.NaN, .5) );
+
+new TestCase(
+ "Math.pow(1.00000001, Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(1.00000001, Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(1.00000001, -Infinity)",
+ 0,
+ Math.pow(1.00000001, Number.NEGATIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(-1.00000001, Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(-1.00000001,Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(-1.00000001, -Infinity)",
+ 0,
+ Math.pow(-1.00000001,Number.NEGATIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(1, Infinity)",
+ Number.NaN,
+ Math.pow(1, Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(1, -Infinity)",
+ Number.NaN,
+ Math.pow(1, Number.NEGATIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(-1, Infinity)",
+ Number.NaN,
+ Math.pow(-1, Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(-1, -Infinity)",
+ Number.NaN,
+ Math.pow(-1, Number.NEGATIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(.0000000009, Infinity)",
+ 0,
+ Math.pow(.0000000009, Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(-.0000000009, Infinity)",
+ 0,
+ Math.pow(-.0000000009, Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(.0000000009, -Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(-.0000000009, Number.NEGATIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(Infinity, .00000000001)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.POSITIVE_INFINITY,.00000000001) );
+
+new TestCase(
+ "Math.pow(Infinity, 1)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.POSITIVE_INFINITY, 1) );
+
+new TestCase(
+ "Math.pow(Infinity, -.00000000001)",
+ 0,
+ Math.pow(Number.POSITIVE_INFINITY, -.00000000001) );
+
+new TestCase(
+ "Math.pow(Infinity, -1)",
+ 0,
+ Math.pow(Number.POSITIVE_INFINITY, -1) );
+
+new TestCase(
+ "Math.pow(-Infinity, 1)",
+ Number.NEGATIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, 1) );
+
+new TestCase(
+ "Math.pow(-Infinity, 333)",
+ Number.NEGATIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, 333) );
+
+new TestCase(
+ "Math.pow(Infinity, 2)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.POSITIVE_INFINITY, 2) );
+
+new TestCase(
+ "Math.pow(-Infinity, 666)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, 666) );
+
+new TestCase(
+ "Math.pow(-Infinity, 0.5)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, 0.5) );
+
+new TestCase(
+ "Math.pow(-Infinity, Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(-Infinity, -1)",
+ -0,
+ Math.pow(Number.NEGATIVE_INFINITY, -1) );
+
+new TestCase(
+ "Infinity/Math.pow(-Infinity, -1)",
+ -Infinity,
+ Infinity/Math.pow(Number.NEGATIVE_INFINITY, -1) );
+
+new TestCase(
+ "Math.pow(-Infinity, -3)",
+ -0,
+ Math.pow(Number.NEGATIVE_INFINITY, -3) );
+
+new TestCase(
+ "Math.pow(-Infinity, -2)",
+ 0,
+ Math.pow(Number.NEGATIVE_INFINITY, -2) );
+
+new TestCase(
+ "Math.pow(-Infinity, -0.5)",
+ 0,
+ Math.pow(Number.NEGATIVE_INFINITY,-0.5) );
+
+new TestCase(
+ "Math.pow(-Infinity, -Infinity)",
+ 0,
+ Math.pow(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(0, 1)",
+ 0,
+ Math.pow(0,1) );
+
+new TestCase(
+ "Math.pow(0, 0)",
+ 1,
+ Math.pow(0,0) );
+
+new TestCase(
+ "Math.pow(1, 0)",
+ 1,
+ Math.pow(1,0) );
+
+new TestCase(
+ "Math.pow(-1, 0)",
+ 1,
+ Math.pow(-1,0) );
+
+new TestCase(
+ "Math.pow(0, 0.5)",
+ 0,
+ Math.pow(0,0.5) );
+
+new TestCase(
+ "Math.pow(0, 1000)",
+ 0,
+ Math.pow(0,1000) );
+
+new TestCase(
+ "Math.pow(0, Infinity)",
+ 0,
+ Math.pow(0, Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(0, -1)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(0, -1) );
+
+new TestCase(
+ "Math.pow(0, -0.5)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(0, -0.5) );
+
+new TestCase(
+ "Math.pow(0, -1000)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(0, -1000) );
+
+new TestCase(
+ "Math.pow(0, -Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(0, Number.NEGATIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(-0, 1)",
+ -0,
+ Math.pow(-0, 1) );
+
+new TestCase(
+ "Math.pow(-0, 3)",
+ -0,
+ Math.pow(-0,3) );
+
+new TestCase(
+ "Infinity/Math.pow(-0, 1)",
+ -Infinity,
+ Infinity/Math.pow(-0, 1) );
+
+new TestCase(
+ "Infinity/Math.pow(-0, 3)",
+ -Infinity,
+ Infinity/Math.pow(-0,3) );
+
+new TestCase(
+ "Math.pow(-0, 2)",
+ 0,
+ Math.pow(-0,2) );
+
+new TestCase(
+ "Math.pow(-0, Infinity)",
+ 0,
+ Math.pow(-0, Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(-0, -1)",
+ Number.NEGATIVE_INFINITY,
+ Math.pow(-0, -1) );
+
+new TestCase(
+ "Math.pow(-0, -10001)",
+ Number.NEGATIVE_INFINITY,
+ Math.pow(-0, -10001) );
+
+new TestCase(
+ "Math.pow(-0, -2)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(-0, -2) );
+
+new TestCase(
+ "Math.pow(-0, 0.5)",
+ 0,
+ Math.pow(-0, 0.5) );
+
+new TestCase(
+ "Math.pow(-0, Infinity)",
+ 0,
+ Math.pow(-0, Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.pow(-1, 0.5)",
+ Number.NaN,
+ Math.pow(-1, 0.5) );
+
+new TestCase(
+ "Math.pow(-1, NaN)",
+ Number.NaN,
+ Math.pow(-1, Number.NaN) );
+
+new TestCase(
+ "Math.pow(-1, -0.5)",
+ Number.NaN,
+ Math.pow(-1, -0.5) );
+
+test();
diff --git a/js/src/tests/non262/Math/15.8.2.16.js b/js/src/tests/non262/Math/15.8.2.16.js
new file mode 100644
index 0000000000..1ad66d4e30
--- /dev/null
+++ b/js/src/tests/non262/Math/15.8.2.16.js
@@ -0,0 +1,96 @@
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+/**
+ File Name: 15.8.2.16.js
+ ECMA Section: 15.8.2.16 sin( x )
+ Description: return an approximation to the sine of the
+ argument. argument is expressed in radians
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+var SECTION = "15.8.2.16";
+var TITLE = "Math.sin(x)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase(
+ "Math.sin.length",
+ 1,
+ Math.sin.length );
+
+new TestCase(
+ "Math.sin()",
+ Number.NaN,
+ Math.sin() );
+
+new TestCase(
+ "Math.sin(null)",
+ 0,
+ Math.sin(null) );
+
+new TestCase(
+ "Math.sin(void 0)",
+ Number.NaN,
+ Math.sin(void 0) );
+
+new TestCase(
+ "Math.sin(false)",
+ 0,
+ Math.sin(false) );
+
+new TestCase(
+ "Math.sin('2.356194490192')",
+ 0.7071067811865,
+ Math.sin('2.356194490192') );
+
+new TestCase(
+ "Math.sin(NaN)",
+ Number.NaN,
+ Math.sin(Number.NaN) );
+
+new TestCase(
+ "Math.sin(0)",
+ 0,
+ Math.sin(0) );
+
+new TestCase(
+ "Math.sin(-0)",
+ -0,
+ Math.sin(-0));
+
+new TestCase(
+ "Math.sin(Infinity)",
+ Number.NaN,
+ Math.sin(Number.POSITIVE_INFINITY));
+
+new TestCase(
+ "Math.sin(-Infinity)",
+ Number.NaN,
+ Math.sin(Number.NEGATIVE_INFINITY));
+
+new TestCase(
+ "Math.sin(0.7853981633974)",
+ 0.7071067811865,
+ Math.sin(0.7853981633974));
+
+new TestCase(
+ "Math.sin(1.570796326795)",
+ 1,
+ Math.sin(1.570796326795));
+
+new TestCase(
+ "Math.sin(2.356194490192)",
+ 0.7071067811865,
+ Math.sin(2.356194490192));
+
+new TestCase(
+ "Math.sin(3.14159265359)",
+ 0,
+ Math.sin(3.14159265359));
+
+test();
diff --git a/js/src/tests/non262/Math/15.8.2.17.js b/js/src/tests/non262/Math/15.8.2.17.js
new file mode 100644
index 0000000000..18b4a0a281
--- /dev/null
+++ b/js/src/tests/non262/Math/15.8.2.17.js
@@ -0,0 +1,181 @@
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+/**
+ File Name: 15.8.2.17.js
+ ECMA Section: 15.8.2.17 Math.sqrt(x)
+ Description: return an approximation to the squareroot of the argument.
+ special cases:
+ - if x is NaN return NaN
+ - if x < 0 return NaN
+ - if x == 0 return 0
+ - if x == -0 return -0
+ - if x == Infinity return Infinity
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "15.8.2.17";
+var TITLE = "Math.sqrt(x)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase(
+ "Math.sqrt.length",
+ 1,
+ Math.sqrt.length );
+
+new TestCase(
+ "Math.sqrt()",
+ Number.NaN,
+ Math.sqrt() );
+
+new TestCase(
+ "Math.sqrt(void 0)",
+ Number.NaN,
+ Math.sqrt(void 0) );
+
+new TestCase(
+ "Math.sqrt(null)",
+ 0,
+ Math.sqrt(null) );
+
+new TestCase(
+ "Math.sqrt(true)",
+ 1,
+ Math.sqrt(1) );
+
+new TestCase(
+ "Math.sqrt(false)",
+ 0,
+ Math.sqrt(false) );
+
+new TestCase(
+ "Math.sqrt('225')",
+ 15,
+ Math.sqrt('225') );
+
+new TestCase(
+ "Math.sqrt(NaN)",
+ Number.NaN,
+ Math.sqrt(Number.NaN) );
+
+new TestCase(
+ "Math.sqrt(-Infinity)",
+ Number.NaN,
+ Math.sqrt(Number.NEGATIVE_INFINITY));
+
+new TestCase(
+ "Math.sqrt(-1)",
+ Number.NaN,
+ Math.sqrt(-1));
+
+new TestCase(
+ "Math.sqrt(-0.5)",
+ Number.NaN,
+ Math.sqrt(-0.5));
+
+new TestCase(
+ "Math.sqrt(0)",
+ 0,
+ Math.sqrt(0));
+
+new TestCase(
+ "Math.sqrt(-0)",
+ -0,
+ Math.sqrt(-0));
+
+new TestCase(
+ "Infinity/Math.sqrt(-0)",
+ -Infinity,
+ Infinity/Math.sqrt(-0) );
+
+new TestCase(
+ "Math.sqrt(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.sqrt(Number.POSITIVE_INFINITY));
+
+new TestCase(
+ "Math.sqrt(1)",
+ 1,
+ Math.sqrt(1));
+
+new TestCase(
+ "Math.sqrt(2)",
+ Math.SQRT2,
+ Math.sqrt(2));
+
+new TestCase(
+ "Math.sqrt(0.5)",
+ Math.SQRT1_2,
+ Math.sqrt(0.5));
+
+new TestCase(
+ "Math.sqrt(4)",
+ 2,
+ Math.sqrt(4));
+
+new TestCase(
+ "Math.sqrt(9)",
+ 3,
+ Math.sqrt(9));
+
+new TestCase(
+ "Math.sqrt(16)",
+ 4,
+ Math.sqrt(16));
+
+new TestCase(
+ "Math.sqrt(25)",
+ 5,
+ Math.sqrt(25));
+
+new TestCase(
+ "Math.sqrt(36)",
+ 6,
+ Math.sqrt(36));
+
+new TestCase(
+ "Math.sqrt(49)",
+ 7,
+ Math.sqrt(49));
+
+new TestCase(
+ "Math.sqrt(64)",
+ 8,
+ Math.sqrt(64));
+
+new TestCase(
+ "Math.sqrt(256)",
+ 16,
+ Math.sqrt(256));
+
+new TestCase(
+ "Math.sqrt(10000)",
+ 100,
+ Math.sqrt(10000));
+
+new TestCase(
+ "Math.sqrt(65536)",
+ 256,
+ Math.sqrt(65536));
+
+new TestCase(
+ "Math.sqrt(0.09)",
+ 0.3,
+ Math.sqrt(0.09));
+
+new TestCase(
+ "Math.sqrt(0.01)",
+ 0.1,
+ Math.sqrt(0.01));
+
+new TestCase(
+ "Math.sqrt(0.00000001)",
+ 0.0001,
+ Math.sqrt(0.00000001));
+
+test();
diff --git a/js/src/tests/non262/Math/15.8.2.18.js b/js/src/tests/non262/Math/15.8.2.18.js
new file mode 100644
index 0000000000..574ec18b99
--- /dev/null
+++ b/js/src/tests/non262/Math/15.8.2.18.js
@@ -0,0 +1,111 @@
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+/**
+ File Name: 15.8.2.18.js
+ ECMA Section: 15.8.2.18 tan( x )
+ Description: return an approximation to the tan of the
+ argument. argument is expressed in radians
+ special cases:
+ - if x is NaN result is NaN
+ - if x is 0 result is 0
+ - if x is -0 result is -0
+ - if x is Infinity or -Infinity result is NaN
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "15.8.2.18";
+var TITLE = "Math.tan(x)";
+var EXCLUDE = "true";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( "Math.tan.length",
+ 1,
+ Math.tan.length );
+
+new TestCase( "Math.tan()",
+ Number.NaN,
+ Math.tan() );
+
+new TestCase( "Math.tan(void 0)",
+ Number.NaN,
+ Math.tan(void 0));
+
+new TestCase( "Math.tan(null)",
+ 0,
+ Math.tan(null) );
+
+new TestCase( "Math.tan(false)",
+ 0,
+ Math.tan(false) );
+
+new TestCase( "Math.tan(NaN)",
+ Number.NaN,
+ Math.tan(Number.NaN) );
+
+new TestCase( "Math.tan(0)",
+ 0,
+ Math.tan(0));
+
+new TestCase( "Math.tan(-0)",
+ -0,
+ Math.tan(-0));
+
+new TestCase( "Math.tan(Infinity)",
+ Number.NaN,
+ Math.tan(Number.POSITIVE_INFINITY));
+
+new TestCase( "Math.tan(-Infinity)",
+ Number.NaN,
+ Math.tan(Number.NEGATIVE_INFINITY));
+
+new TestCase( "Math.tan(Math.PI/4)",
+ 1,
+ Math.tan(Math.PI/4));
+
+new TestCase( "Math.tan(3*Math.PI/4)",
+ -1,
+ Math.tan(3*Math.PI/4));
+
+new TestCase( "Math.tan(Math.PI)",
+ -0,
+ Math.tan(Math.PI));
+
+new TestCase( "Math.tan(5*Math.PI/4)",
+ 1,
+ Math.tan(5*Math.PI/4));
+
+new TestCase( "Math.tan(7*Math.PI/4)",
+ -1,
+ Math.tan(7*Math.PI/4));
+
+new TestCase( "Infinity/Math.tan(-0)",
+ -Infinity,
+ Infinity/Math.tan(-0) );
+
+/*
+ Arctan (x) ~ PI/2 - 1/x for large x. For x = 1.6x10^16, 1/x is about the last binary digit of double precision PI/2.
+ That is to say, perturbing PI/2 by this much is about the smallest rounding error possible.
+
+ This suggests that the answer Christine is getting and a real Infinity are "adjacent" results from the tangent function. I
+ suspect that tan (PI/2 + one ulp) is a negative result about the same size as tan (PI/2) and that this pair are the closest
+ results to infinity that the algorithm can deliver.
+
+ In any case, my call is that the answer we're seeing is "right". I suggest the test pass on any result this size or larger.
+ = C =
+*/
+
+new TestCase( "Math.tan(3*Math.PI/2) >= 5443000000000000",
+ true,
+ Math.tan(3*Math.PI/2) >= 5443000000000000 );
+
+new TestCase( "Math.tan(Math.PI/2) >= 5443000000000000",
+ true,
+ Math.tan(Math.PI/2) >= 5443000000000000 );
+
+test();
diff --git a/js/src/tests/non262/Math/15.8.2.2.js b/js/src/tests/non262/Math/15.8.2.2.js
new file mode 100644
index 0000000000..fef32b9e41
--- /dev/null
+++ b/js/src/tests/non262/Math/15.8.2.2.js
@@ -0,0 +1,120 @@
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+/**
+ File Name: 15.8.2.2.js
+ ECMA Section: 15.8.2.2 acos( x )
+ Description: return an approximation to the arc cosine of the
+ argument. the result is expressed in radians and
+ range is from +0 to +PI. special cases:
+ - if x is NaN, return NaN
+ - if x > 1, the result is NaN
+ - if x < -1, the result is NaN
+ - if x == 1, the result is +0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+var SECTION = "15.8.2.2";
+var TITLE = "Math.acos()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase(
+ "Math.acos.length",
+ 1,
+ Math.acos.length );
+
+new TestCase(
+ "Math.acos(void 0)",
+ Number.NaN,
+ Math.acos(void 0) );
+
+new TestCase(
+ "Math.acos()",
+ Number.NaN,
+ Math.acos() );
+
+new TestCase(
+ "Math.acos(null)",
+ Math.PI/2,
+ Math.acos(null) );
+
+new TestCase(
+ "Math.acos(NaN)",
+ Number.NaN,
+ Math.acos(Number.NaN) );
+
+new TestCase(
+ "Math.acos(a string)",
+ Number.NaN,
+ Math.acos("a string") );
+
+new TestCase(
+ "Math.acos('0')",
+ Math.PI/2,
+ Math.acos('0') );
+
+new TestCase(
+ "Math.acos('1')",
+ 0,
+ Math.acos('1') );
+
+new TestCase(
+ "Math.acos('-1')",
+ Math.PI,
+ Math.acos('-1') );
+
+new TestCase(
+ "Math.acos(1.00000001)",
+ Number.NaN,
+ Math.acos(1.00000001) );
+
+new TestCase(
+ "Math.acos(11.00000001)",
+ Number.NaN,
+ Math.acos(-1.00000001) );
+
+new TestCase(
+ "Math.acos(1)",
+ 0,
+ Math.acos(1) );
+
+new TestCase(
+ "Math.acos(-1)",
+ Math.PI,
+ Math.acos(-1) );
+
+new TestCase(
+ "Math.acos(0)",
+ Math.PI/2,
+ Math.acos(0) );
+
+new TestCase(
+ "Math.acos(-0)",
+ Math.PI/2,
+ Math.acos(-0) );
+
+new TestCase(
+ "Math.acos(Math.SQRT1_2)",
+ Math.PI/4,
+ Math.acos(Math.SQRT1_2));
+
+new TestCase(
+ "Math.acos(-Math.SQRT1_2)",
+ Math.PI/4*3,
+ Math.acos(-Math.SQRT1_2));
+
+new TestCase(
+ "Math.acos(0.9999619230642)",
+ Math.PI/360,
+ Math.acos(0.9999619230642));
+
+new TestCase(
+ "Math.acos(-3.0)",
+ Number.NaN,
+ Math.acos(-3.0));
+
+test();
diff --git a/js/src/tests/non262/Math/15.8.2.3.js b/js/src/tests/non262/Math/15.8.2.3.js
new file mode 100644
index 0000000000..750f22bb60
--- /dev/null
+++ b/js/src/tests/non262/Math/15.8.2.3.js
@@ -0,0 +1,122 @@
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+/**
+ File Name: 15.8.2.3.js
+ ECMA Section: 15.8.2.3 asin( x )
+ Description: return an approximation to the arc sine of the
+ argument. the result is expressed in radians and
+ range is from -PI/2 to +PI/2. special cases:
+ - if x is NaN, the result is NaN
+ - if x > 1, the result is NaN
+ - if x < -1, the result is NaN
+ - if x == +0, the result is +0
+ - if x == -0, the result is -0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+var SECTION = "15.8.2.3";
+var TITLE = "Math.asin()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase(
+ "Math.asin()",
+ Number.NaN,
+ Math.asin() );
+
+new TestCase(
+ "Math.asin(void 0)",
+ Number.NaN,
+ Math.asin(void 0) );
+
+new TestCase(
+ "Math.asin(null)",
+ 0,
+ Math.asin(null) );
+
+new TestCase(
+ "Math.asin(NaN)",
+ Number.NaN,
+ Math.asin(Number.NaN) );
+
+new TestCase(
+ "Math.asin('string')",
+ Number.NaN,
+ Math.asin("string") );
+
+new TestCase(
+ "Math.asin('0')",
+ 0,
+ Math.asin("0") );
+
+new TestCase(
+ "Math.asin('1')",
+ Math.PI/2,
+ Math.asin("1") );
+
+new TestCase(
+ "Math.asin('-1')",
+ -Math.PI/2,
+ Math.asin("-1") );
+
+new TestCase(
+ "Math.asin(Math.SQRT1_2+'')",
+ Math.PI/4,
+ Math.asin(Math.SQRT1_2+'') );
+
+new TestCase(
+ "Math.asin(-Math.SQRT1_2+'')",
+ -Math.PI/4,
+ Math.asin(-Math.SQRT1_2+'') );
+
+new TestCase(
+ "Math.asin(1.000001)",
+ Number.NaN,
+ Math.asin(1.000001) );
+
+new TestCase(
+ "Math.asin(-1.000001)",
+ Number.NaN,
+ Math.asin(-1.000001) );
+
+new TestCase(
+ "Math.asin(0)",
+ 0,
+ Math.asin(0) );
+
+new TestCase(
+ "Math.asin(-0)",
+ -0,
+ Math.asin(-0) );
+
+new TestCase(
+ "Infinity/Math.asin(-0)",
+ -Infinity,
+ Infinity/Math.asin(-0) );
+
+new TestCase(
+ "Math.asin(1)",
+ Math.PI/2,
+ Math.asin(1) );
+
+new TestCase(
+ "Math.asin(-1)",
+ -Math.PI/2,
+ Math.asin(-1) );
+
+new TestCase(
+ "Math.asin(Math.SQRT1_2))",
+ Math.PI/4,
+ Math.asin(Math.SQRT1_2) );
+
+new TestCase(
+ "Math.asin(-Math.SQRT1_2))",
+ -Math.PI/4,
+ Math.asin(-Math.SQRT1_2));
+
+test();
diff --git a/js/src/tests/non262/Math/15.8.2.4.js b/js/src/tests/non262/Math/15.8.2.4.js
new file mode 100644
index 0000000000..ee957aa93e
--- /dev/null
+++ b/js/src/tests/non262/Math/15.8.2.4.js
@@ -0,0 +1,121 @@
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+/**
+ File Name: 15.8.2.4.js
+ ECMA Section: 15.8.2.4 atan( x )
+ Description: return an approximation to the arc tangent of the
+ argument. the result is expressed in radians and
+ range is from -PI/2 to +PI/2. special cases:
+ - if x is NaN, the result is NaN
+ - if x == +0, the result is +0
+ - if x == -0, the result is -0
+ - if x == +Infinity, the result is approximately +PI/2
+ - if x == -Infinity, the result is approximately -PI/2
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+
+var SECTION = "15.8.2.4";
+var TITLE = "Math.atan()";
+var BUGNUMBER="77391";
+
+printBugNumber(BUGNUMBER);
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase(
+ "Math.atan.length",
+ 1,
+ Math.atan.length );
+
+new TestCase(
+ "Math.atan()",
+ Number.NaN,
+ Math.atan() );
+
+new TestCase(
+ "Math.atan(void 0)",
+ Number.NaN,
+ Math.atan(void 0) );
+
+new TestCase(
+ "Math.atan(null)",
+ 0,
+ Math.atan(null) );
+
+new TestCase(
+ "Math.atan(NaN)",
+ Number.NaN,
+ Math.atan(Number.NaN) );
+
+new TestCase(
+ "Math.atan('a string')",
+ Number.NaN,
+ Math.atan("a string") );
+
+new TestCase(
+ "Math.atan('0')",
+ 0,
+ Math.atan('0') );
+
+new TestCase(
+ "Math.atan('1')",
+ Math.PI/4,
+ Math.atan('1') );
+
+new TestCase(
+ "Math.atan('-1')",
+ -Math.PI/4,
+ Math.atan('-1') );
+
+new TestCase(
+ "Math.atan('Infinity)",
+ Math.PI/2,
+ Math.atan('Infinity') );
+
+new TestCase(
+ "Math.atan('-Infinity)",
+ -Math.PI/2,
+ Math.atan('-Infinity') );
+
+new TestCase(
+ "Math.atan(0)",
+ 0,
+ Math.atan(0) );
+
+new TestCase(
+ "Math.atan(-0)",
+ -0,
+ Math.atan(-0) );
+
+new TestCase(
+ "Infinity/Math.atan(-0)",
+ -Infinity,
+ Infinity/Math.atan(-0) );
+
+new TestCase(
+ "Math.atan(Infinity)",
+ Math.PI/2,
+ Math.atan(Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.atan(-Infinity)",
+ -Math.PI/2,
+ Math.atan(Number.NEGATIVE_INFINITY) );
+
+new TestCase(
+ "Math.atan(1)",
+ Math.PI/4,
+ Math.atan(1) );
+
+new TestCase(
+ "Math.atan(-1)",
+ -Math.PI/4,
+ Math.atan(-1) );
+
+test();
diff --git a/js/src/tests/non262/Math/15.8.2.5.js b/js/src/tests/non262/Math/15.8.2.5.js
new file mode 100644
index 0000000000..0f1cf7182e
--- /dev/null
+++ b/js/src/tests/non262/Math/15.8.2.5.js
@@ -0,0 +1,209 @@
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+/**
+ File Name: 15.8.2.5.js
+ ECMA Section: 15.8.2.5 atan2( y, x )
+ Description:
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+var SECTION = "15.8.2.5";
+var TITLE = "Math.atan2(x,y)";
+var BUGNUMBER="76111";
+
+printBugNumber(BUGNUMBER);
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase(
+ "Math.atan2.length",
+ 2,
+ Math.atan2.length );
+
+new TestCase(
+ "Math.atan2(NaN, 0)",
+ Number.NaN,
+ Math.atan2(Number.NaN,0) );
+
+new TestCase(
+ "Math.atan2(null, null)",
+ 0,
+ Math.atan2(null, null) );
+
+new TestCase(
+ "Math.atan2(void 0, void 0)",
+ Number.NaN,
+ Math.atan2(void 0, void 0) );
+
+new TestCase(
+ "Math.atan2()",
+ Number.NaN,
+ Math.atan2() );
+
+new TestCase(
+ "Math.atan2(0, NaN)",
+ Number.NaN,
+ Math.atan2(0,Number.NaN) );
+
+new TestCase(
+ "Math.atan2(1, 0)",
+ Math.PI/2,
+ Math.atan2(1,0) );
+
+new TestCase(
+ "Math.atan2(1,-0)",
+ Math.PI/2,
+ Math.atan2(1,-0) );
+
+new TestCase(
+ "Math.atan2(0,0.001)",
+ 0,
+ Math.atan2(0,0.001) );
+
+new TestCase(
+ "Math.atan2(0,0)",
+ 0,
+ Math.atan2(0,0) );
+
+new TestCase(
+ "Math.atan2(0, -0)",
+ Math.PI,
+ Math.atan2(0,-0) );
+
+new TestCase(
+ "Math.atan2(0, -1)",
+ Math.PI,
+ Math.atan2(0, -1) );
+
+new TestCase(
+ "Math.atan2(-0, 1)",
+ -0,
+ Math.atan2(-0, 1) );
+
+new TestCase(
+ "Infinity/Math.atan2(-0, 1)",
+ -Infinity,
+ Infinity/Math.atan2(-0,1) );
+
+new TestCase(
+ "Math.atan2(-0, 0)",
+ -0,
+ Math.atan2(-0,0) );
+
+new TestCase(
+ "Math.atan2(-0, -0)",
+ -Math.PI,
+ Math.atan2(-0, -0) );
+
+new TestCase(
+ "Math.atan2(-0, -1)",
+ -Math.PI,
+ Math.atan2(-0, -1) );
+
+new TestCase(
+ "Math.atan2(-1, 0)",
+ -Math.PI/2,
+ Math.atan2(-1, 0) );
+
+new TestCase(
+ "Math.atan2(-1, -0)",
+ -Math.PI/2,
+ Math.atan2(-1, -0) );
+
+new TestCase(
+ "Math.atan2(1, Infinity)",
+ 0,
+ Math.atan2(1, Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.atan2(1,-Infinity)",
+ Math.PI,
+ Math.atan2(1, Number.NEGATIVE_INFINITY) );
+
+new TestCase(
+ "Math.atan2(-1, Infinity)",
+ -0,
+ Math.atan2(-1,Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Infinity/Math.atan2(-1, Infinity)",
+ -Infinity,
+ Infinity/Math.atan2(-1,Infinity) );
+
+new TestCase(
+ "Math.atan2(-1,-Infinity)",
+ -Math.PI,
+ Math.atan2(-1,Number.NEGATIVE_INFINITY) );
+
+new TestCase(
+ "Math.atan2(Infinity, 0)",
+ Math.PI/2,
+ Math.atan2(Number.POSITIVE_INFINITY, 0) );
+
+new TestCase(
+ "Math.atan2(Infinity, 1)",
+ Math.PI/2,
+ Math.atan2(Number.POSITIVE_INFINITY, 1) );
+
+new TestCase(
+ "Math.atan2(Infinity,-1)",
+ Math.PI/2,
+ Math.atan2(Number.POSITIVE_INFINITY,-1) );
+
+new TestCase(
+ "Math.atan2(Infinity,-0)",
+ Math.PI/2,
+ Math.atan2(Number.POSITIVE_INFINITY,-0) );
+
+new TestCase(
+ "Math.atan2(-Infinity, 0)",
+ -Math.PI/2,
+ Math.atan2(Number.NEGATIVE_INFINITY, 0) );
+
+new TestCase(
+ "Math.atan2(-Infinity,-0)",
+ -Math.PI/2,
+ Math.atan2(Number.NEGATIVE_INFINITY,-0) );
+
+new TestCase(
+ "Math.atan2(-Infinity, 1)",
+ -Math.PI/2,
+ Math.atan2(Number.NEGATIVE_INFINITY, 1) );
+
+new TestCase(
+ "Math.atan2(-Infinity, -1)",
+ -Math.PI/2,
+ Math.atan2(Number.NEGATIVE_INFINITY,-1) );
+
+new TestCase(
+ "Math.atan2(Infinity, Infinity)",
+ Math.PI/4,
+ Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.atan2(Infinity, -Infinity)",
+ 3*Math.PI/4,
+ Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) );
+
+new TestCase(
+ "Math.atan2(-Infinity, Infinity)",
+ -Math.PI/4,
+ Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.atan2(-Infinity, -Infinity)",
+ -3*Math.PI/4,
+ Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
+
+new TestCase(
+ "Math.atan2(-1, 1)",
+ -Math.PI/4,
+ Math.atan2( -1, 1) );
+
+test();
diff --git a/js/src/tests/non262/Math/15.8.2.7.js b/js/src/tests/non262/Math/15.8.2.7.js
new file mode 100644
index 0000000000..70af7e679f
--- /dev/null
+++ b/js/src/tests/non262/Math/15.8.2.7.js
@@ -0,0 +1,247 @@
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+/**
+ File Name: 15.8.2.7.js
+ ECMA Section: 15.8.2.7 cos( x )
+ Description: return an approximation to the cosine of the
+ argument. argument is expressed in radians
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+
+var SECTION = "15.8.2.7";
+var TITLE = "Math.cos(x)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase(
+ "Math.cos.length",
+ 1,
+ Math.cos.length );
+
+new TestCase(
+ "Math.cos()",
+ Number.NaN,
+ Math.cos() );
+
+new TestCase(
+ "Math.cos(void 0)",
+ Number.NaN,
+ Math.cos(void 0) );
+
+new TestCase(
+ "Math.cos(false)",
+ 1,
+ Math.cos(false) );
+
+new TestCase(
+ "Math.cos(null)",
+ 1,
+ Math.cos(null) );
+
+new TestCase(
+ "Math.cos('0')",
+ 1,
+ Math.cos('0') );
+
+new TestCase(
+ "Math.cos('Infinity')",
+ Number.NaN,
+ Math.cos("Infinity") );
+
+new TestCase(
+ "Math.cos('3.14159265359')",
+ -1,
+ Math.cos('3.14159265359') );
+
+new TestCase(
+ "Math.cos(NaN)",
+ Number.NaN,
+ Math.cos(Number.NaN) );
+
+new TestCase(
+ "Math.cos(0)",
+ 1,
+ Math.cos(0) );
+
+new TestCase(
+ "Math.cos(-0)",
+ 1,
+ Math.cos(-0) );
+
+new TestCase(
+ "Math.cos(Infinity)",
+ Number.NaN,
+ Math.cos(Number.POSITIVE_INFINITY) );
+
+new TestCase(
+ "Math.cos(-Infinity)",
+ Number.NaN,
+ Math.cos(Number.NEGATIVE_INFINITY) );
+
+new TestCase(
+ "Math.cos(0.7853981633974)",
+ 0.7071067811865,
+ Math.cos(0.7853981633974) );
+
+new TestCase(
+ "Math.cos(1.570796326795)",
+ 0,
+ Math.cos(1.570796326795) );
+
+new TestCase(
+ "Math.cos(2.356194490192)",
+ -0.7071067811865,
+ Math.cos(2.356194490192) );
+
+new TestCase(
+ "Math.cos(3.14159265359)",
+ -1,
+ Math.cos(3.14159265359) );
+
+new TestCase(
+ "Math.cos(3.926990816987)",
+ -0.7071067811865,
+ Math.cos(3.926990816987) );
+
+new TestCase(
+ "Math.cos(4.712388980385)",
+ 0,
+ Math.cos(4.712388980385) );
+
+new TestCase(
+ "Math.cos(5.497787143782)",
+ 0.7071067811865,
+ Math.cos(5.497787143782) );
+
+new TestCase(
+ "Math.cos(Math.PI*2)",
+ 1,
+ Math.cos(Math.PI*2) );
+
+new TestCase(
+ "Math.cos(Math.PI/4)",
+ Math.SQRT2/2,
+ Math.cos(Math.PI/4) );
+
+new TestCase(
+ "Math.cos(Math.PI/2)",
+ 0,
+ Math.cos(Math.PI/2) );
+
+new TestCase(
+ "Math.cos(3*Math.PI/4)",
+ -Math.SQRT2/2,
+ Math.cos(3*Math.PI/4) );
+
+new TestCase(
+ "Math.cos(Math.PI)",
+ -1,
+ Math.cos(Math.PI) );
+
+new TestCase(
+ "Math.cos(5*Math.PI/4)",
+ -Math.SQRT2/2,
+ Math.cos(5*Math.PI/4) );
+
+new TestCase(
+ "Math.cos(3*Math.PI/2)",
+ 0,
+ Math.cos(3*Math.PI/2) );
+
+new TestCase(
+ "Math.cos(7*Math.PI/4)",
+ Math.SQRT2/2,
+ Math.cos(7*Math.PI/4) );
+
+new TestCase(
+ "Math.cos(Math.PI*2)",
+ 1,
+ Math.cos(2*Math.PI) );
+
+new TestCase(
+ "Math.cos(-0.7853981633974)",
+ 0.7071067811865,
+ Math.cos(-0.7853981633974) );
+
+new TestCase(
+ "Math.cos(-1.570796326795)",
+ 0,
+ Math.cos(-1.570796326795) );
+
+new TestCase(
+ "Math.cos(-2.3561944901920)",
+ -.7071067811865,
+ Math.cos(2.3561944901920) );
+
+new TestCase(
+ "Math.cos(-3.14159265359)",
+ -1,
+ Math.cos(3.14159265359) );
+
+new TestCase(
+ "Math.cos(-3.926990816987)",
+ -0.7071067811865,
+ Math.cos(3.926990816987) );
+
+new TestCase(
+ "Math.cos(-4.712388980385)",
+ 0,
+ Math.cos(4.712388980385) );
+
+new TestCase(
+ "Math.cos(-5.497787143782)",
+ 0.7071067811865,
+ Math.cos(5.497787143782) );
+
+new TestCase(
+ "Math.cos(-6.28318530718)",
+ 1,
+ Math.cos(6.28318530718) );
+
+new TestCase(
+ "Math.cos(-Math.PI/4)",
+ Math.SQRT2/2,
+ Math.cos(-Math.PI/4) );
+
+new TestCase(
+ "Math.cos(-Math.PI/2)",
+ 0,
+ Math.cos(-Math.PI/2) );
+
+new TestCase(
+ "Math.cos(-3*Math.PI/4)",
+ -Math.SQRT2/2,
+ Math.cos(-3*Math.PI/4) );
+
+new TestCase(
+ "Math.cos(-Math.PI)",
+ -1,
+ Math.cos(-Math.PI) );
+
+new TestCase(
+ "Math.cos(-5*Math.PI/4)",
+ -Math.SQRT2/2,
+ Math.cos(-5*Math.PI/4) );
+
+new TestCase(
+ "Math.cos(-3*Math.PI/2)",
+ 0,
+ Math.cos(-3*Math.PI/2) );
+
+new TestCase(
+ "Math.cos(-7*Math.PI/4)",
+ Math.SQRT2/2,
+ Math.cos(-7*Math.PI/4) );
+
+new TestCase(
+ "Math.cos(-Math.PI*2)",
+ 1,
+ Math.cos(-Math.PI*2) );
+
+test();
diff --git a/js/src/tests/non262/Math/15.8.2.8.js b/js/src/tests/non262/Math/15.8.2.8.js
new file mode 100644
index 0000000000..78f7eb7898
--- /dev/null
+++ b/js/src/tests/non262/Math/15.8.2.8.js
@@ -0,0 +1,84 @@
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+/**
+ File Name: 15.8.2.8.js
+ ECMA Section: 15.8.2.8 Math.exp(x)
+ Description: return an approximation to the exponential function of
+ the argument (e raised to the power of the argument)
+ special cases:
+ - if x is NaN return NaN
+ - if x is 0 return 1
+ - if x is -0 return 1
+ - if x is Infinity return Infinity
+ - if x is -Infinity return 0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+
+var SECTION = "15.8.2.8";
+var TITLE = "Math.exp(x)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( "Math.exp.length",
+ 1,
+ Math.exp.length );
+
+new TestCase( "Math.exp()",
+ Number.NaN,
+ Math.exp() );
+
+new TestCase( "Math.exp(null)",
+ 1,
+ Math.exp(null) );
+
+new TestCase( "Math.exp(void 0)",
+ Number.NaN,
+ Math.exp(void 0) );
+
+new TestCase( "Math.exp(1)",
+ Math.E,
+ Math.exp(1) );
+
+new TestCase( "Math.exp(true)",
+ Math.E,
+ Math.exp(true) );
+
+new TestCase( "Math.exp(false)",
+ 1,
+ Math.exp(false) );
+
+new TestCase( "Math.exp('1')",
+ Math.E,
+ Math.exp('1') );
+
+new TestCase( "Math.exp('0')",
+ 1,
+ Math.exp('0') );
+
+new TestCase( "Math.exp(NaN)",
+ Number.NaN,
+ Math.exp(Number.NaN) );
+
+new TestCase( "Math.exp(0)",
+ 1,
+ Math.exp(0) );
+
+new TestCase( "Math.exp(-0)",
+ 1,
+ Math.exp(-0) );
+
+new TestCase( "Math.exp(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.exp(Number.POSITIVE_INFINITY) );
+
+new TestCase( "Math.exp(-Infinity)",
+ 0,
+ Math.exp(Number.NEGATIVE_INFINITY) );
+
+test();
diff --git a/js/src/tests/non262/Math/20.2.2.ToNumber.js b/js/src/tests/non262/Math/20.2.2.ToNumber.js
new file mode 100644
index 0000000000..de1f4e612c
--- /dev/null
+++ b/js/src/tests/non262/Math/20.2.2.ToNumber.js
@@ -0,0 +1,112 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+/*
+ * ECMA-262 6th Edition / Draft November 8, 2013
+ *
+ * 20.2.2 Function Properties of the Math Object
+ */
+
+/*
+ * This custom object will allow us to check if valueOf() is called
+ */
+
+TestNumber.prototype = new Number();
+
+function TestNumber(value) {
+ this.value = value;
+ this.valueOfCalled = false;
+}
+
+TestNumber.prototype = {
+ valueOf: function() {
+ this.valueOfCalled = true;
+ return this.value;
+ }
+}
+
+// Verify that each TestNumber's flag is set after calling Math func
+function test(func /*, args */) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ func.apply(null, args);
+
+ for (var i = 0; i < args.length; ++i)
+ assertEq(args[i].valueOfCalled, true);
+}
+
+// Note that we are not testing these functions' return values
+// We only test whether valueOf() is called for each argument
+
+// 1. Test Math.atan2()
+var x = new TestNumber(1);
+test(Math.atan2, x);
+
+var x = new TestNumber(1);
+var y = new TestNumber(2);
+test(Math.atan2, y, x);
+
+// Remove comment block once patch for bug 896264 is approved
+/*
+// 2. Test Math.hypot()
+var x = new TestNumber(1);
+test(Math.hypot, x);
+
+var x = new TestNumber(1);
+var y = new TestNumber(2);
+test(Math.hypot, x, y);
+
+var x = new TestNumber(1);
+var y = new TestNumber(2);
+var z = new TestNumber(3);
+test(Math.hypot, x, y, z);
+*/
+
+// Remove comment block once patch for bug 808148 is approved
+/*
+// 3. Test Math.imul()
+var x = new TestNumber(1);
+test(Math.imul, x);
+
+var x = new TestNumber(1);
+var y = new TestNumber(2);
+test(Math.imul, x, y);
+*/
+
+// 4. Test Math.max()
+var x = new TestNumber(1);
+test(Math.max, x);
+
+var x = new TestNumber(1);
+var y = new TestNumber(2);
+test(Math.max, x, y);
+
+var x = new TestNumber(1);
+var y = new TestNumber(2);
+var z = new TestNumber(3);
+test(Math.max, x, y, z);
+
+// 5. Test Math.min()
+var x = new TestNumber(1);
+test(Math.min, x);
+
+var x = new TestNumber(1);
+var y = new TestNumber(2);
+test(Math.min, x, y);
+
+var x = new TestNumber(1);
+var y = new TestNumber(2);
+var z = new TestNumber(3);
+test(Math.min, x, y, z);
+
+// 6. Test Math.pow()
+var x = new TestNumber(1);
+test(Math.pow, x);
+
+var x = new TestNumber(1);
+var y = new TestNumber(2);
+test(Math.pow, x, y);
+
+reportCompare(0, 0, "ok");
+
diff --git a/js/src/tests/non262/Math/Pow.js b/js/src/tests/non262/Math/Pow.js
new file mode 100644
index 0000000000..281c716a76
--- /dev/null
+++ b/js/src/tests/non262/Math/Pow.js
@@ -0,0 +1,117 @@
+// |reftest| skip-if(!xulRuntime.shell)
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var BUGNUMBER = 1135708;
+var summary = "Implement the exponentiation operator";
+
+print(BUGNUMBER + ": " + summary);
+
+// Constant folding
+assertEq(2 ** 2 ** 3, 256);
+assertEq(1 ** 1 ** 4, 1);
+
+// No folding
+var two = 2;
+var three = 3;
+var four = 4;
+assertEq(two ** two ** three, 256);
+assertEq(1 ** 1 ** four, 1);
+
+// Operator precedence
+assertEq(2 ** 3 / 2 ** 3, 1);
+assertEq(2 ** 3 * 2 ** 3, 64);
+assertEq(2 ** 3 + 2 ** 3, 16);
+
+// With parentheses
+assertEq((2 ** 3) ** 2, 64);
+assertEq(2 ** (3 ** 2), 512);
+
+// Assignment operator
+var x = 2;
+assertEq(x **= 2 ** 3, 256);
+assertEq(x, 256);
+
+// Loop to test baseline and ION
+for (var i=0; i<10000; i++) {
+ assertEq((2 ** 3) ** 2, 64);
+ assertEq(2 ** (3 ** 2), 512);
+ var x = 2;
+ assertEq(x **= 2 ** 3, 256);
+ assertEq(x, 256);
+}
+
+// Comments should not be confused with exp operator
+var a, c, e;
+a = c = e = 2;
+assertEq(a**/**b**/c/**/**/**d**/e, 16);
+
+// Two stars separated should not parse as exp operator
+assertThrowsInstanceOf(function() { return Reflect.parse("2 * * 3"); }, SyntaxError);
+
+// Left-hand side expression must not be a unary expression.
+for (let unaryOp of ["delete", "typeof", "void", "+", "-", "!", "~"]) {
+ assertThrowsInstanceOf(() => eval(unaryOp + " a ** 2"), SyntaxError);
+ assertThrowsInstanceOf(() => eval(unaryOp + " " + unaryOp + " a ** 2"), SyntaxError);
+}
+
+// Test the other |delete| operators (DELETENAME and DELETEEXPR are already tested above).
+assertThrowsInstanceOf(() => eval("delete a.name ** 2"), SyntaxError);
+assertThrowsInstanceOf(() => eval("delete a[0] ** 2"), SyntaxError);
+
+// Unary expression lhs is valid if parenthesized.
+for (let unaryOp of ["delete", "void", "+", "-", "!", "~"]) {
+ let a = 0;
+ eval("(" + unaryOp + " a) ** 2");
+ eval("(" + unaryOp + " " + unaryOp + " a) ** 2");
+}
+{
+ let a = {};
+ (delete a.name) ** 2;
+ (delete a[0]) ** 2;
+}
+
+// Check if error propagation works
+var thrower = {
+ get value() {
+ throw new Error();
+ }
+};
+
+assertThrowsInstanceOf(function() { return thrower.value ** 2; }, Error);
+assertThrowsInstanceOf(function() { return 2 ** thrower.value; }, Error);
+assertThrowsInstanceOf(function() { return 2 ** thrower.value ** 2; }, Error);
+
+var convertibleToPrimitive = {
+ valueOf: function() {
+ throw new Error("oops");
+ }
+};
+
+assertThrowsInstanceOf(function() { return convertibleToPrimitive ** 3; }, Error);
+assertThrowsInstanceOf(function() { return 3 ** convertibleToPrimitive; }, Error);
+
+assertEq(NaN ** 2, NaN);
+assertEq(2 ** NaN, NaN);
+assertEq(2 ** "3", 8);
+assertEq("2" ** 3, 8);
+
+// Reflect.parse generates a correct parse tree for simplest case
+var parseTree = Reflect.parse("a ** b");
+assertEq(parseTree.body[0].type, "ExpressionStatement");
+assertEq(parseTree.body[0].expression.operator, "**");
+assertEq(parseTree.body[0].expression.left.name, "a");
+assertEq(parseTree.body[0].expression.right.name, "b");
+
+// Reflect.parse generates a tree following the right-associativity rule
+var parseTree = Reflect.parse("a ** b ** c");
+assertEq(parseTree.body[0].type, "ExpressionStatement");
+assertEq(parseTree.body[0].expression.left.name, "a");
+assertEq(parseTree.body[0].expression.right.operator, "**");
+assertEq(parseTree.body[0].expression.right.left.name, "b");
+assertEq(parseTree.body[0].expression.right.right.name, "c");
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/non262/Math/acosh-approx.js b/js/src/tests/non262/Math/acosh-approx.js
new file mode 100644
index 0000000000..3854a5909d
--- /dev/null
+++ b/js/src/tests/non262/Math/acosh-approx.js
@@ -0,0 +1,283 @@
+var cosh_data = [
+ [1.0000014305114746, 0.0016914556651292944],
+ [1.0000019073486328, 0.001953124689559275],
+ [1.000007152557373, 0.003782208044661295],
+ [1.000013828277588, 0.005258943946801101],
+ [1.0000171661376953, 0.005859366618129203],
+ [1.0000600814819336, 0.010961831992188852],
+ [1.0001168251037598, 0.015285472131830425],
+ [1.0001487731933594, 0.017249319093529877],
+ [1.0003981590270996, 0.028218171738655373],
+ [1.000638484954834, 0.03573281468231457],
+ [1.0010714530944824, 0.046287402472878776],
+ [1.0030217170715332, 0.07771996527168971],
+ [1.0049939155578613, 0.0998975930860278],
+ [1.0092840194702148, 0.13615938768032465],
+ [1.024169921875, 0.21942279004958354],
+ [1.0622773170471191, 0.3511165938166055],
+ [1.1223440170288086, 0.48975026711288183],
+ [1.2495574951171875, 0.692556883708491],
+ [1.4912219047546387, 0.954530572221414],
+ [1.9838471412658691, 1.307581416910453],
+ [2.1576128005981445, 1.4035188779741334],
+ [2.406397819519043, 1.5250070845427517],
+ [3.386958122253418, 1.8905372013072799],
+ [4.451677322387695, 2.1735673399948254],
+ [6.9391326904296875, 2.625091127868242],
+ [7.756023406982422, 2.737434918695162],
+ [8.882369995117188, 2.8740317167801948],
+ [9.869171142578125, 2.97998639328949],
+ [16.848876953125, 3.516549380542481],
+ [16.88458251953125, 3.51867003468025],
+ [18.18859100341797, 3.593185165198829],
+ [18.82012176513672, 3.6273672142963385],
+ [19.184181213378906, 3.646553244410946],
+ [24.039520263671875, 3.872413451393967],
+ [26.556991577148438, 3.972085568933329],
+ [27.921104431152344, 4.022209178119238],
+ [32.314666748046875, 4.168428891496629],
+ [34.73008728027344, 4.240546229861005],
+ [36.51556396484375, 4.290698214968891],
+ [38.851287841796875, 4.352722738491574],
+ [49.46875, 4.594386162629449],
+ [49.67265319824219, 4.598500387004538],
+ [55.821014404296875, 4.7152173401856095],
+ [57.119781494140625, 4.73822104001982],
+ [60.37983703613281, 4.793733825338029],
+ [63.4661865234375, 4.8435923769530165],
+ [63.822418212890625, 4.849190310904695],
+ [64.36642456054688, 4.85767897228448],
+ [65.82318115234375, 4.880061548144127],
+ [68.60302734375, 4.921430721025434],
+ [70.173583984375, 4.94406835208057],
+ [71.80126953125, 4.967000841791218],
+ [75.40786743164062, 5.016014824864732],
+ [75.49771118164062, 5.017205657609766],
+ [78.06475830078125, 5.0506448716550825],
+ [79.64892578125, 5.0707363201405276],
+ [79.8707275390625, 5.073517411135063],
+ [82.14324951171875, 5.101574796209937],
+ [86.42214965820312, 5.152357710985635],
+ [87.75869750976562, 5.167705692500117],
+ [94.24942016601562, 5.2390637098028074],
+ [95.00259399414062, 5.247023676519904],
+ [96.06402587890625, 5.258134994273664],
+ [99.10101318359375, 5.289261389093961],
+ [104.82595825195312, 5.345425863147171],
+ [105.89431762695312, 5.3555664787245885],
+ [106.750244140625, 5.363617180711895],
+ [109.40167236328125, 5.388152468690488],
+ [111.29598999023438, 5.405320225963013],
+ [112.68215942382812, 5.417698597745429],
+ [115.84786987304688, 5.445406415908933],
+ [122.51895141601562, 5.501396249028249],
+ [126.29083251953125, 5.531718947357248],
+ [127.88677978515625, 5.544277233951787],
+ [128.29241943359375, 5.547444176085567],
+ [129.49658203125, 5.556786759298988],
+ [138.73651123046875, 5.625710723366437],
+ [139.18450927734375, 5.628934733085022],
+ [139.9705810546875, 5.634566685055491],
+ [143.6336669921875, 5.660401141376928],
+ [149.2176513671875, 5.698541939965668],
+ [150.61602783203125, 5.7078698961812995],
+ [151.65460205078125, 5.714741890601693],
+ [154.77532958984375, 5.735111323217677],
+ [158.9586181640625, 5.761781191641161],
+ [159.23260498046875, 5.763503378028959],
+ [166.89166259765625, 5.810483079631769],
+ [169.22418212890625, 5.824362807770767],
+ [170.85247802734375, 5.833939098607025],
+ [175.641845703125, 5.861586030831371],
+ [176.47808837890625, 5.866335876872544],
+ [177.0284423828125, 5.869449614294116],
+ [178.81622314453125, 5.879497954012966],
+ [181.28570556640625, 5.893213844044451],
+ [190.84246826171875, 5.944588630523773],
+ [191.39764404296875, 5.947493525920713],
+ [194.2606201171875, 5.962341215900494],
+ [194.89630126953125, 5.9656082276276],
+ [196.72125244140625, 5.9749284849312865],
+ [196.76788330078125, 5.975165500176202],
+ [198.0592041015625, 5.981706804024238],
+ [199.97052001953125, 5.991310884439669],
+ [202.70001220703125, 6.004868209578554],
+ [204.95684814453125, 6.0159406892865155],
+ [206.92059326171875, 6.025476453825986],
+ [211.4588623046875, 6.047172064627678],
+ [211.6217041015625, 6.0479418642231595],
+ [212.15936279296875, 6.050479329955437],
+ [219.93341064453125, 6.086466833749719],
+ [223.34747314453125, 6.101870903204913],
+ [228.56036376953125, 6.1249427443985525],
+ [229.53656005859375, 6.129204755426344],
+ [231.15753173828125, 6.136241935513706],
+ [235.22589111328125, 6.153688953514383],
+ [237.17108154296875, 6.1619244798633215],
+ [237.904541015625, 6.165012268502458],
+ [243.202392578125, 6.187036941752032],
+ [244.296875, 6.191527178125454],
+ [245.39239501953125, 6.196001570568187],
+ [245.80389404296875, 6.197677082130341],
+ [249.68365478515625, 6.2133379061260285],
+ [252.32763671875, 6.223871642756905],
+ [253.4725341796875, 6.228398760115369],
+ [264.1583251953125, 6.269692237869835],
+ [265.867919921875, 6.276143287577458],
+ [273.893798828125, 6.305884283737176],
+ [274.060546875, 6.306492908028797],
+ [274.06298828125, 6.3065018163217115],
+ [275.31201171875, 6.31104892482331],
+ [281.2171630859375, 6.3322712125431915],
+ [284.3428955078125, 6.343324976847916],
+ [284.8428955078125, 6.345081883725142],
+ [287.3035888671875, 6.353683609448096],
+ [290.8973388671875, 6.366114643735997],
+ [293.0467529296875, 6.373476431987165],
+ [293.048583984375, 6.3734826803404045],
+ [296.819091796875, 6.3862671775996915],
+ [297.6572265625, 6.389086936901673],
+ [308.40625, 6.424562459508495],
+ [316.5472412109375, 6.4506171773701535],
+ [320.2418212890625, 6.462221144761522],
+ [322.33642578125, 6.468740575092418],
+ [323.5101318359375, 6.472375224718483],
+ [327.8939208984375, 6.485834999462654],
+ [328.0833740234375, 6.486412623146554],
+ [328.214599609375, 6.486812521370483],
+ [332.13916015625, 6.498698952535687],
+ [339.6888427734375, 6.521175044233963],
+ [340.171630859375, 6.522595306993373],
+ [340.22998046875, 6.522766822935215],
+ [340.9984130859375, 6.52502285413445],
+ [347.719482421875, 6.5445411825986985],
+ [347.921142578125, 6.5451209675856825],
+ [349.8392333984375, 6.55061885367159],
+ [353.1812744140625, 6.560126626713879],
+ [353.3170166015625, 6.560510895819139],
+ [354.9730224609375, 6.565186990039135],
+ [355.6412353515625, 6.567067660815945],
+ [363.193603515625, 6.588081320423386],
+ [363.7503662109375, 6.5896131163651415],
+ [366.66650390625, 6.597598047275183],
+ [370.5828857421875, 6.608222493065004],
+ [371.822998046875, 6.611563301604297],
+ [375.8822021484375, 6.622421213257873],
+ [377.1107177734375, 6.625684248051368],
+ [377.588623046875, 6.626950731244344],
+ [378.8428955078125, 6.630267034079059],
+ [379.1123046875, 6.630977920761718],
+ [381.1038818359375, 6.636217452968849],
+ [382.1112060546875, 6.638857149899159],
+ [382.9927978515625, 6.641161660644278],
+ [387.1845703125, 6.652047018118426],
+ [389.669921875, 6.658445560711748],
+ [389.804443359375, 6.658790721334144],
+ [396.3114013671875, 6.675345858154136],
+ [397.005126953125, 6.677094789236718],
+ [397.1934814453125, 6.6775691166680895],
+ [397.8046875, 6.679106750673113],
+ [398.8426513671875, 6.681712590609845],
+ [399.1663818359375, 6.682523938576487],
+ [399.2547607421875, 6.68274532345516],
+ [400.33984375, 6.685459416477178],
+ [403.9578857421875, 6.694456277839498],
+ [404.279541015625, 6.6952522228540765],
+ [405.0574951171875, 6.6971746771142415],
+ [407.328125, 6.702764738337774],
+ [407.547119140625, 6.7033022311799595],
+ [410.5994873046875, 6.710763953621196],
+ [410.8016357421875, 6.711256159037373],
+ [411.129638671875, 6.712054288828399],
+ [411.9053955078125, 6.713939407502346],
+ [415.5833740234375, 6.722828986708716],
+ [417.669189453125, 6.727835453862132],
+ [420.517822265625, 6.734632628835641],
+ [424.3853759765625, 6.743787740494532],
+ [424.7154541015625, 6.744565219553757],
+ [436.3419189453125, 6.7715720212680655],
+ [438.501953125, 6.776510146304201],
+ [439.3369140625, 6.778412462065226],
+ [445.5606689453125, 6.79247934060035],
+ [452.9901123046875, 6.809016260337229],
+ [453.77490234375, 6.810747231716348],
+ [456.7745361328125, 6.817335895109251],
+ [457.9520263671875, 6.819910421197311],
+ [458.6795654296875, 6.821497844004013],
+ [460.5164794921875, 6.8254946428721475],
+ [461.8717041015625, 6.828433164406687],
+ [464.7025146484375, 6.834543470287694],
+ [467.0626220703125, 6.839609377592375],
+ [467.0712890625, 6.839627933844213],
+ [470.096923828125, 6.846084943645239],
+ [475.1607666015625, 6.856799276049143],
+ [477.5537109375, 6.861822721577315],
+ [478.626220703125, 6.864066049482581],
+ [478.7958984375, 6.864420497333681],
+ [479.6864013671875, 6.866278653973069],
+ [479.7867431640625, 6.866487814627139],
+ [479.9122314453125, 6.8667493311188395],
+ [482.4793701171875, 6.872084270243208],
+ [482.5181884765625, 6.872164723177875],
+ [483.8797607421875, 6.874982560453874],
+ [484.4649658203125, 6.876191234145179],
+ [485.3258056640625, 6.877966548833207],
+ [490.57373046875, 6.888721726428236],
+ [493.7423095703125, 6.89515989558997],
+ [494.272216796875, 6.896232568812718],
+ [496.44775390625, 6.900624415355815],
+ [497.0401611328125, 6.901816998553275],
+ [498.234130859375, 6.9042162822876465],
+ [665.0791015625, 7.193052598670793],
+ [1170.29150390625, 7.758155143419732],
+ [2058.7958984375, 8.323023697145112],
+ [5824.533203125, 9.36298131161099],
+ [9114.30859375, 9.810748008110926],
+ [31388.40625, 11.047341056314202],
+ [53732.765625, 11.584925435512535],
+ [117455.09375, 12.366958539207397],
+ [246210.625, 13.107089828327874],
+ [513670.125, 13.84248373881162],
+ [788353.25, 14.27084873575108],
+ [1736171, 15.060339852215408],
+ [3770530, 15.835873313657556],
+ [4344090, 15.977474039173265],
+ [11419360, 16.943967899150145],
+ [31023240, 17.943394339560967],
+ [40665424, 18.214035936745432],
+ [129788064, 19.374560581709215],
+ [225668224, 19.927723623778547],
+ [450631936, 20.619308638400597],
+ [750941952, 21.129986093026698],
+ [1887358976, 22.05159150215413],
+ [3738011648, 22.734966842639743],
+ [7486695424, 23.42954051928097],
+ [12668080128, 23.955498471391667],
+ [23918272512, 24.591055724582848],
+ [48862560256, 25.305424481799395],
+ [113763549184, 26.150535181949436],
+ [161334755328, 26.499894449532565],
+ [321933279232, 27.19075733422632],
+ [715734122496, 27.989721778208146],
+ [1875817529344, 28.953212876533797]
+];
+
+var sloppy_tolerance = 8; // FIXME
+
+for (var [x, y] of cosh_data)
+ assertNear(Math.acosh(x), y, sloppy_tolerance);
+
+assertNear(Math.acosh(1e300), 691.4686750787737, sloppy_tolerance);
+assertNear(Math.acosh(1.0000000001), 0.000014142136208675862, sloppy_tolerance);
+
+for (var i = 0; i <= 100; i++) {
+ var x = (i - 50) / 5;
+ var y = Math.cosh(x);
+ var z = Math.acosh(y);
+ assertNear(z, Math.abs(x), sloppy_tolerance);
+}
+
+for (var i = 1; i < 20; i++)
+ assertNear(Math.acosh(Math.cosh(i)), i, sloppy_tolerance);
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/acosh-exact.js b/js/src/tests/non262/Math/acosh-exact.js
new file mode 100644
index 0000000000..ededaa48e1
--- /dev/null
+++ b/js/src/tests/non262/Math/acosh-exact.js
@@ -0,0 +1,26 @@
+// Properties of Math.acosh that are guaranteed by the spec.
+
+// If x is NaN, the result is NaN.
+assertEq(Math.acosh(NaN), NaN);
+
+// If x is less than 1, the result is NaN.
+assertEq(Math.acosh(ONE_MINUS_EPSILON), NaN);
+assertEq(Math.acosh(Number.MIN_VALUE), NaN);
+assertEq(Math.acosh(+0), NaN);
+assertEq(Math.acosh(-0), NaN);
+assertEq(Math.acosh(-Number.MIN_VALUE), NaN);
+assertEq(Math.acosh(-1), NaN);
+assertEq(Math.acosh(-Number.MAX_VALUE), NaN);
+assertEq(Math.acosh(-Infinity), NaN);
+
+for (var i = -20; i < 1; i++)
+ assertEq(Math.acosh(i), NaN);
+
+// If x is 1, the result is +0.
+assertEq(Math.acosh(1), +0);
+
+// If x is +∞, the result is +∞.
+assertEq(Math.acosh(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY);
+
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/asinh-approx.js b/js/src/tests/non262/Math/asinh-approx.js
new file mode 100644
index 0000000000..354454fb40
--- /dev/null
+++ b/js/src/tests/non262/Math/asinh-approx.js
@@ -0,0 +1,303 @@
+var sinh_data = [
+ [-497.181640625, -6.902103625349695],
+ [-495.216552734375, -6.898143347143859],
+ [-488.0980224609375, -6.883664481302669],
+ [-486.4609375, -6.880304842490273],
+ [-482.2261962890625, -6.871561546509046],
+ [-468.167236328125, -6.841973895837549],
+ [-465.553955078125, -6.836376331805493],
+ [-464.288330078125, -6.833654100575195],
+ [-463.558837890625, -6.8320816635009045],
+ [-453.82861328125, -6.8108680173663085],
+ [-448.7835693359375, -6.799689165151487],
+ [-446.0499267578125, -6.793579326246197],
+ [-432.4046630859375, -6.762510387544996],
+ [-424.145751953125, -6.743225720989222],
+ [-402.8682861328125, -6.691758395994307],
+ [-402.4595947265625, -6.690743430063694],
+ [-390.1383056640625, -6.6596501292114505],
+ [-387.5355224609375, -6.652956360641761],
+ [-381.0023193359375, -6.635954365364267],
+ [-374.8172607421875, -6.619587562578274],
+ [-374.1033935546875, -6.617681179427804],
+ [-373.01318359375, -6.614762741096185],
+ [-370.0938720703125, -6.60690568753706],
+ [-364.5230712890625, -6.591738907156094],
+ [-361.3756103515625, -6.583066984213974],
+ [-358.1136474609375, -6.573999516974134],
+ [-350.8861083984375, -6.553610904389896],
+ [-350.7060546875, -6.553097634736138],
+ [-345.5616455078125, -6.538320325468202],
+ [-342.386962890625, -6.529090881007076],
+ [-341.9425048828125, -6.527791927233787],
+ [-337.3883056640625, -6.514383886150781],
+ [-328.8133544921875, -6.488639771044976],
+ [-326.1348876953125, -6.480460592697477],
+ [-313.12744140625, -6.439759999015992],
+ [-311.6180419921875, -6.434927968512049],
+ [-303.40478515625, -6.4082177348965725],
+ [-291.9320068359375, -6.369671035834965],
+ [-289.791015625, -6.362310184909175],
+ [-288.07568359375, -6.356373428913315],
+ [-282.76220703125, -6.337756593913614],
+ [-278.9659423828125, -6.32424009706147],
+ [-276.1881103515625, -6.314232650754295],
+ [-269.843994140625, -6.290994606392703],
+ [-256.47509765625, -6.240182555852785],
+ [-248.91619873046875, -6.2102675039793604],
+ [-245.71783447265625, -6.197335184435549],
+ [-244.9049072265625, -6.194021350132335],
+ [-242.49176025390625, -6.184119163536406],
+ [-223.97491455078125, -6.104686221071835],
+ [-223.0770263671875, -6.100669325836893],
+ [-221.50177001953125, -6.093582856519022],
+ [-214.1610107421875, -6.0598807500687935],
+ [-202.9705810546875, -6.0062142965262515],
+ [-200.1683349609375, -5.9923121073369945],
+ [-198.0869140625, -5.981859446096083],
+ [-191.8330078125, -5.9497792165852905],
+ [-183.4495849609375, -5.90509449745879],
+ [-182.9005126953125, -5.902097012275789],
+ [-167.5517578125, -5.8144483910067954],
+ [-162.87738037109375, -5.786154254111214],
+ [-159.6142578125, -5.765917008989405],
+ [-150.01629638671875, -5.703902219845274],
+ [-148.34051513671875, -5.6926689504460395],
+ [-147.23760986328125, -5.685206387751923],
+ [-143.65484619140625, -5.660572815631807],
+ [-138.70599365234375, -5.625516713960633],
+ [-119.55416870117188, -5.476934234171879],
+ [-118.44155883789062, -5.467584665632571],
+ [-112.7041015625, -5.417932675603434],
+ [-111.43020629882812, -5.406565756574079],
+ [-107.77297973632812, -5.373195678988387],
+ [-107.6795654296875, -5.3723285712183735],
+ [-105.091796875, -5.348004040102253],
+ [-101.261474609375, -5.31087758970896],
+ [-95.79150390625, -5.255348419702703],
+ [-91.26885986328125, -5.206986845736275],
+ [-87.33349609375, -5.162914035396619],
+ [-78.23873901367188, -5.052952927749896],
+ [-77.912353515625, -5.048772883924985],
+ [-76.83489990234375, -5.034848487644809],
+ [-61.255645751953125, -4.808269821238499],
+ [-54.41380310058594, -4.689849459883311],
+ [-43.967193603515625, -4.476720236388958],
+ [-42.01084899902344, -4.431216695067421],
+ [-30.609375, -4.114720236218123],
+ [-26.711166381835938, -3.9785790831656023],
+ [-25.241317749023438, -3.9220215830953484],
+ [-14.624359130859375, -3.3770026324620295],
+ [-12.431087493896484, -3.214961448471211],
+ [-10.235607147216797, -3.021397455139021],
+ [-9.41094970703125, -2.937831931335705],
+ [-1.635939121246338, -1.267878515574959],
+ [1.6504814008555524e-12, 1.6504814008555524e-12],
+ [2.0654207510961697e-12, 2.0654207510961697e-12],
+ [6.933230031758164e-12, 6.933230031758164e-12],
+ [1.3351444949627478e-11, 1.3351444949627478e-11],
+ [1.6399812063916386e-11, 1.6399812063916386e-11],
+ [5.730159402528301e-11, 5.730159402528301e-11],
+ [1.113731329382972e-10, 1.113731329382972e-10],
+ [1.4214707189097453e-10, 1.4214707189097453e-10],
+ [3.8006320313144215e-10, 3.8006320313144215e-10],
+ [6.09162720266454e-10, 6.09162720266454e-10],
+ [1.0221641311147778e-9, 1.0221641311147778e-9],
+ [2.8819222563924995e-9, 2.8819222563924995e-9],
+ [4.7627768395841485e-9, 4.7627768395841485e-9],
+ [8.854133426439148e-9, 8.854133426439148e-9],
+ [2.3050326092288742e-8, 2.305032609228874e-8],
+ [5.9392490925347374e-8, 5.939249092534734e-8],
+ [1.166764889148908e-7, 1.1667648891489053e-7],
+ [2.3799674409019644e-7, 2.379967440901942e-7],
+ [4.684659415943315e-7, 4.6846594159431437e-7],
+ [9.382699772686465e-7, 9.382699772685088e-7],
+ [0.00000110398559627356, 0.0000011039855962733358],
+ [0.0000032917760108830407, 0.000003291776010877096],
+ [0.00000751721381675452, 0.000007517213816683722],
+ [0.000015114666894078255, 0.000015114666893502755],
+ [0.00002986399340443313, 0.00002986399339999406],
+ [0.00003387028118595481, 0.000033870281179478836],
+ [0.00009066011989489198, 0.00009066011977069884],
+ [0.00021949532674625516, 0.00021949532498377364],
+ [0.00043952150736004114, 0.00043952149320897676],
+ [0.0006333151832222939, 0.0006333151408864353],
+ [0.001115123275667429, 0.0011151230445582744],
+ [0.001962467096745968, 0.0019624658370807177],
+ [0.005553754046559334, 0.005553725496786973],
+ [0.008691128343343735, 0.008691018931968294],
+ [0.02993336319923401, 0.02992889492062484],
+ [0.05124260485172272, 0.05122020579778827],
+ [0.11201295256614685, 0.1117800293787828],
+ [0.23480379581451416, 0.23269806521543376],
+ [0.4898730516433716, 0.4721357117742938],
+ [0.7518312931060791, 0.694611571189336],
+ [1.655740737915039, 1.2781607348262256],
+ [3.5958566665649414, 1.9917262343245115],
+ [3.662705421447754, 2.009484184971722],
+ [4.142845153808594, 2.128787712416205],
+ [5.957065582275391, 2.4846967934155475],
+ [10.890350341796875, 3.083125584533294],
+ [27.3714599609375, 4.002981567623351],
+ [29.58606719970703, 4.080736210902826],
+ [30.79753875732422, 4.120845430011113],
+ [38.78157043457031, 4.351258506393416],
+ [46.88148498535156, 4.540883728536112],
+ [47.21551513671875, 4.547981853382592],
+ [47.2205810546875, 4.5480891170767],
+ [49.72361755371094, 4.599728302509061],
+ [61.557464599609375, 4.8131842711857535],
+ [67.82162475585938, 4.910082619934558],
+ [68.82363891601562, 4.924747230639767],
+ [73.75466918945312, 4.993937439635391],
+ [80.95669555664062, 5.087099712053554],
+ [85.26406860351562, 5.1389346970196295],
+ [85.2677001953125, 5.138977285472121],
+ [92.8238525390625, 5.223879832616765],
+ [94.50357055664062, 5.241812789460327],
+ [116.044677734375, 5.447141014648796],
+ [123.77554321289062, 5.511633288238573],
+ [132.3592529296875, 5.578681289305598],
+ [139.7633056640625, 5.633110296634631],
+ [143.9609375, 5.662701238627725],
+ [146.31298828125, 5.678906941005323],
+ [155.0980224609375, 5.737214893086866],
+ [155.47784423828125, 5.739660763047893],
+ [155.74066162109375, 5.741349685869528],
+ [163.60546875, 5.790614371552514],
+ [178.735107421875, 5.879059869096351],
+ [179.70269775390625, 5.884458728291027],
+ [179.81976318359375, 5.885109945587401],
+ [181.3594970703125, 5.893636014368936],
+ [194.82861328125, 5.965274032538233],
+ [195.23284912109375, 5.967346683696556],
+ [199.07666015625, 5.986843466070591],
+ [205.77423095703125, 6.019932686217942],
+ [206.04608154296875, 6.021252909681261],
+ [209.36480712890625, 6.037231102920489],
+ [210.703857421875, 6.043606439928324],
+ [215.2139892578125, 6.06478541011501],
+ [225.83892822265625, 6.112974120371601],
+ [226.95465087890625, 6.117902255760311],
+ [232.79864501953125, 6.1433256889594094],
+ [240.647216796875, 6.176483527820343],
+ [243.1324462890625, 6.186757751007361],
+ [251.26702880859375, 6.219667373726848],
+ [253.72906494140625, 6.229418088083555],
+ [254.6866455078125, 6.233184983047428],
+ [257.2001953125, 6.243005711460192],
+ [257.7401123046875, 6.245102704489327],
+ [261.731201171875, 6.260468857392134],
+ [263.75, 6.268152459140511],
+ [265.5167236328125, 6.2748285545831655],
+ [273.9171142578125, 6.305976070434008],
+ [278.897705078125, 6.32399546069982],
+ [279.167236328125, 6.324961403980197],
+ [292.207275390625, 6.370613506132747],
+ [293.5975341796875, 6.375359978930309],
+ [293.9749755859375, 6.3766447200146],
+ [295.1998291015625, 6.380802563199264],
+ [297.2799072265625, 6.387824152942429],
+ [297.9285888671875, 6.390003820200831],
+ [298.1058349609375, 6.3905985680679],
+ [300.2803955078125, 6.397866642974941],
+ [307.531005859375, 6.421725738171608],
+ [308.1754150390625, 6.423818963102848],
+ [309.7344970703125, 6.428865255911759],
+ [314.2847900390625, 6.443449261058927],
+ [314.7236328125, 6.444844602076255],
+ [320.8406982421875, 6.464094341970107],
+ [321.2459716796875, 6.465356699668166],
+ [321.9031982421875, 6.467400466944125],
+ [323.457763671875, 6.472218114936839],
+ [330.82861328125, 6.4947499213823265],
+ [335.008544921875, 6.507305446835735],
+ [340.7171630859375, 6.524202033435675],
+ [348.4677734375, 6.546694993078936],
+ [349.1292724609375, 6.548591493378012],
+ [372.4288330078125, 6.613194950203132],
+ [376.7574462890625, 6.6247505436339065],
+ [378.4306640625, 6.629181796246806],
+ [390.9031982421875, 6.6616087711302185],
+ [405.7918701171875, 6.698989091751707],
+ [407.3646240234375, 6.702857353572475],
+ [413.3758544921875, 6.717505881986416],
+ [415.7354736328125, 6.723197804327891],
+ [417.193603515625, 6.726699007993023],
+ [420.874755859375, 6.735483889307782],
+ [429.2635498046875, 6.755219602793124],
+ [429.756103515625, 6.756366380816258],
+ [433.9931640625, 6.766177290841293],
+ [434.0106201171875, 6.766217511883346],
+ [440.073974609375, 6.780091308338912],
+ [450.2220458984375, 6.802889310303153],
+ [455.017578125, 6.813484439494547],
+ [457.1668701171875, 6.818196843455478],
+ [457.5068359375, 6.818940201487998],
+ [459.2913818359375, 6.822833193143805],
+ [459.492431640625, 6.82327083544577],
+ [459.743896484375, 6.823817951018],
+ [464.888427734375, 6.834945773756887],
+ [464.96630859375, 6.835113285253827],
+ [467.6949462890625, 6.840964582694129],
+ [468.86767578125, 6.84346890521034],
+ [470.5927734375, 6.847141429556457],
+ [481.109619140625, 6.869243403190376],
+ [487.4595947265625, 6.882355637062964],
+ [488.521484375, 6.884531678915821],
+ [492.8812255859375, 6.89341643293734],
+ [494.0684814453125, 6.895822338701104],
+ [496.4613037109375, 6.900653737167637],
+ [716.154052734375, 7.2670429692740965],
+ [1799.92578125, 8.188647968122073],
+ [3564.845703125, 8.872023251113289],
+ [7139.869140625, 9.566596912986167],
+ [12081.22265625, 10.092554861905608],
+ [22810.2421875, 10.728112113864427],
+ [46598.96875, 11.442480870715618],
+ [108493.375, 12.28759157077177],
+ [153860.8125, 12.636950838344218],
+ [307019.5, 13.327813723030063],
+ [682577.25, 14.126778167009777],
+ [1788919, 15.090269265334971],
+ [3769169, 15.835512291283944],
+ [4327820, 15.973721689554742],
+ [11044024, 16.910547205715446],
+ [21423208, 17.573132558903225],
+ [62828288, 18.649063156437965],
+ [70207360, 18.760110887365155],
+ [154231424, 19.547111966180875],
+ [294509056, 20.193967491567523],
+ [1070557184, 21.484592263156223],
+ [1957922816, 22.088297141021556],
+ [3912507392, 22.780591462699917],
+ [7279233024, 23.401438520318692],
+ [9665245184, 23.684949498080787],
+ [22627590144, 24.5355829820426],
+ [60601991168, 25.520740767599584],
+ [134018236416, 26.31438890085422],
+ [204864946176, 26.73876398039979],
+ [284346286080, 27.06660583008718],
+ [914576637952, 28.234874284944635],
+ [1581915832320, 28.78280496108106]
+];
+
+for (var [x, y] of sinh_data)
+ assertNear(Math.asinh(x), y);
+
+assertNear(Math.asinh(1e300), 691.4686750787737);
+assertNear(Math.asinh(1e-300), 1e-300);
+assertNear(Math.asinh(1e-5), 0.000009999999999833334);
+assertNear(Math.asinh(0.3), 0.29567304756342244);
+assertNear(Math.asinh(1), 0.881373587019543);
+
+for (var i = 0; i <= 80; i++) {
+ var x = (i - 40) / 4;
+ assertNear(Math.asinh(Math.sinh(x)), x);
+}
+
+for (var i = -20; i < 20; i++)
+ assertNear(Math.asinh(Math.sinh(i)), i);
+
+reportCompare(0, 0, "ok");
+
diff --git a/js/src/tests/non262/Math/asinh-exact.js b/js/src/tests/non262/Math/asinh-exact.js
new file mode 100644
index 0000000000..49463d01fc
--- /dev/null
+++ b/js/src/tests/non262/Math/asinh-exact.js
@@ -0,0 +1,19 @@
+// Properties of Math.asinh that are guaranteed by the spec.
+
+// If x is NaN, the result is NaN.
+assertEq(Math.asinh(NaN), NaN);
+
+// If x is +0, the result is +0.
+assertEq(Math.asinh(+0), +0);
+
+// If x is −0, the result is −0.
+assertEq(Math.asinh(-0), -0);
+
+// If x is +∞, the result is +∞.
+assertEq(Math.asinh(Infinity), Infinity);
+
+// If x is −∞, the result is −∞.
+assertEq(Math.asinh(-Infinity), -Infinity);
+
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/atanh-approx.js b/js/src/tests/non262/Math/atanh-approx.js
new file mode 100644
index 0000000000..fcf61892db
--- /dev/null
+++ b/js/src/tests/non262/Math/atanh-approx.js
@@ -0,0 +1,280 @@
+var tanh_data = [
+ [-0.9999983310699463, -6.998237084679027],
+ [-0.9999978542327881, -6.87257975132917],
+ [-0.999992847442627, -6.2705920974657525],
+ [-0.9999861717224121, -5.940967614084813],
+ [-0.9999828338623047, -5.832855225378502],
+ [-0.9999399185180664, -5.20646301208756],
+ [-0.9998834133148193, -4.8749821841810785],
+ [-0.9998509883880615, -4.752279497280338],
+ [-0.9996016025543213, -4.260504202858904],
+ [-0.9993612766265869, -4.0244334353203115],
+ [-0.9989283084869385, -3.7655641082999236],
+ [-0.9969782829284668, -3.246782610980921],
+ [-0.9950058460235596, -2.9950671179940938],
+ [-0.9942638874053955, -2.9256242749609536],
+ [-0.990715742111206, -2.6839646283308363],
+ [-0.9903340339660645, -2.663723350226518],
+ [-0.9760982990264893, -2.207464998348322],
+ [-0.975830078125, -2.201817459680556],
+ [-0.9728245735168457, -2.1424542308291437],
+ [-0.9643559455871582, -2.0046686756020917],
+ [-0.9377224445343018, -1.7188337346177065],
+ [-0.9362406730651855, -1.7066940482565154],
+ [-0.9310147762298584, -1.6659543005533146],
+ [-0.9284839630126953, -1.6472838718760747],
+ [-0.9270248413085938, -1.6368067340881562],
+ [-0.9075665473937988, -1.5135473477311114],
+ [-0.897477388381958, -1.4590986086331497],
+ [-0.8920106887817383, -1.431681573516303],
+ [-0.8776559829711914, -1.365471286049011],
+ [-0.864722728729248, -1.3117705583444539],
+ [-0.8482067584991455, -1.249725893334944],
+ [-0.8056559562683105, -1.1145246028592257],
+ [-0.8048388957977295, -1.112200609756455],
+ [-0.7801985740661621, -1.0458778330822556],
+ [-0.7749934196472168, -1.032711173436253],
+ [-0.7619285583496094, -1.0007967281362184],
+ [-0.7504425048828125, -0.9739672824457072],
+ [-0.7495596408843994, -0.9719492983286864],
+ [-0.7481319904327393, -0.968698942014487],
+ [-0.7459518909454346, -0.9637657636705832],
+ [-0.7401137351989746, -0.9507308314464193],
+ [-0.7289731502532959, -0.9265325319867653],
+ [-0.7226788997650146, -0.9132299082876396],
+ [-0.7161557674407959, -0.8997082193533088],
+ [-0.7017018795013428, -0.8706453720344796],
+ [-0.7013418674468994, -0.86993650130945],
+ [-0.691054105758667, -0.8499705913361888],
+ [-0.6847054958343506, -0.837919455842005],
+ [-0.6838164329528809, -0.8362476144993315],
+ [-0.6747090816497803, -0.8193374156276964],
+ [-0.6575610637664795, -0.7885046044142132],
+ [-0.6522045135498047, -0.7791255597799839],
+ [-0.6261923313140869, -0.7351275788820003],
+ [-0.623173713684082, -0.7301771459970386],
+ [-0.6067488193511963, -0.7037597526130627],
+ [-0.5838055610656738, -0.6682166303197608],
+ [-0.579524040222168, -0.6617457665293066],
+ [-0.5760939121246338, -0.656596458857398],
+ [-0.5654678344726562, -0.6408350116350283],
+ [-0.5578761100769043, -0.6297442839791668],
+ [-0.5523209571838379, -0.6217149641475687],
+ [-0.5396339893341064, -0.6036390747171698],
+ [-0.5128989219665527, -0.5666556256064771],
+ [-0.5087778568267822, -0.5610793900942042],
+ [-0.4977825880050659, -0.546353950571504],
+ [-0.4913865327835083, -0.5378865967606703],
+ [-0.48976075649261475, -0.5357455496477738],
+ [-0.48493504524230957, -0.5294166456244711],
+ [-0.4479050636291504, -0.4820764946679979],
+ [-0.4461095333099365, -0.4798325976916711],
+ [-0.4429593086242676, -0.47590653371561276],
+ [-0.42827916145324707, -0.45778739362936793],
+ [-0.40590059757232666, -0.4306933608076879],
+ [-0.40029656887054443, -0.4240020382545707],
+ [-0.3961341381072998, -0.4190551379319939],
+ [-0.3836275339126587, -0.40430627175908734],
+ [-0.36686253547668457, -0.3847928551425507],
+ [-0.3657644987106323, -0.38352464227459343],
+ [-0.33507001399993896, -0.3485286317501442],
+ [-0.32572221755981445, -0.3380352468276522],
+ [-0.3191967010498047, -0.3307524237890151],
+ [-0.3000025749206543, -0.3095224337886503],
+ [-0.29665136337280273, -0.3058438250228025],
+ [-0.2944457530975342, -0.3034271164344305],
+ [-0.2872810363769531, -0.29560018347246825],
+ [-0.27738428115844727, -0.28484608203169437],
+ [-0.2390844225883484, -0.2438028008332661],
+ [-0.23685944080352783, -0.24144425169391517],
+ [-0.2253856658935547, -0.2293228153248168],
+ [-0.22283810377120972, -0.22664053064745143],
+ [-0.21552443504333496, -0.21895773601143995],
+ [-0.2153375744819641, -0.21876178107952995],
+ [-0.21016258001327515, -0.21334143320771737],
+ [-0.20250272750854492, -0.2053409277979887],
+ [-0.19156384468078613, -0.19396008474133075],
+ [-0.18251943588256836, -0.18458771439322938],
+ [-0.17464947700500488, -0.17645844608618066],
+ [-0.15646183490753174, -0.15775766677189154],
+ [-0.15580910444259644, -0.15708862621964176],
+ [-0.15365445613861084, -0.15488112515549593],
+ [-0.122499018907547, -0.12311733609904851],
+ [-0.1088167130947113, -0.10924929296737837],
+ [-0.08792558312416077, -0.08815322150790302],
+ [-0.08401328325271606, -0.08421178632314608],
+ [-0.06121261417865753, -0.06128924075509796],
+ [-0.05341699719429016, -0.05346789060550386],
+ [-0.05047759413719177, -0.05052053189238029],
+ [-0.02924579381942749, -0.029254136237332657],
+ [-0.02485968917608261, -0.02486481220617492],
+ [-0.020469173789024353, -0.02047203328100153],
+ [-0.01882001757621765, -0.018822240021756347],
+ [-0.016152501106262207, -0.016153906073109205],
+ [-0.0032715508714318275, -0.003271562543358962],
+ [1.6504814008555524e-12, 1.6504814008555524e-12],
+ [2.0654207510961697e-12, 2.0654207510961697e-12],
+ [6.933230031758164e-12, 6.933230031758164e-12],
+ [1.3351444949627478e-11, 1.3351444949627478e-11],
+ [1.6399812063916386e-11, 1.6399812063916386e-11],
+ [5.730159402528301e-11, 5.730159402528301e-11],
+ [1.113731329382972e-10, 1.113731329382972e-10],
+ [1.4214707189097453e-10, 1.4214707189097453e-10],
+ [3.8006320313144215e-10, 3.8006320313144215e-10],
+ [6.09162720266454e-10, 6.09162720266454e-10],
+ [1.0221641311147778e-9, 1.0221641311147778e-9],
+ [2.8819222563924995e-9, 2.8819222563924995e-9],
+ [4.7627768395841485e-9, 4.7627768395841485e-9],
+ [8.854133426439148e-9, 8.854133426439148e-9],
+ [2.3050326092288742e-8, 2.3050326092288745e-8],
+ [5.9392490925347374e-8, 5.939249092534745e-8],
+ [1.166764889148908e-7, 1.1667648891489133e-7],
+ [2.3799674409019644e-7, 2.3799674409020094e-7],
+ [4.684659415943315e-7, 4.684659415943658e-7],
+ [9.382699772686465e-7, 9.382699772689218e-7],
+ [0.00000110398559627356, 0.0000011039855962740086],
+ [0.0000032917760108830407, 0.0000032917760108949305],
+ [0.00000751721381675452, 0.000007517213816896115],
+ [0.000015114666894078255, 0.000015114666895229252],
+ [0.00002986399340443313, 0.00002986399341331128],
+ [0.00003387028118595481, 0.000033870281198906756],
+ [0.00009066011989489198, 0.00009066012014327826],
+ [0.00021949532674625516, 0.0002194953302712184],
+ [0.00043952150736004114, 0.0004395215356621756],
+ [0.0006333151832222939, 0.0006333152678940465],
+ [0.001115123275667429, 0.0011151237378863419],
+ [0.001962467096745968, 0.001962469616086656],
+ [0.005553754046559334, 0.005553811147953338],
+ [0.007324676960706711, 0.0073248079567425],
+ [0.008691128343343735, 0.008691347183450786],
+ [0.011912941932678223, 0.011913505535037906],
+ [0.02993336319923401, 0.029942308168570204],
+ [0.05124260485172272, 0.05128752666822782],
+ [0.05473744869232178, 0.05479221508125444],
+ [0.06158891320228577, 0.061666963819518306],
+ [0.09375360608100891, 0.09402975380882211],
+ [0.09442159533500671, 0.09470370926367391],
+ [0.09443172812461853, 0.09471393321406026],
+ [0.09943729639053345, 0.09976699249016487],
+ [0.11201295256614685, 0.11248498303558895],
+ [0.12310260534286499, 0.12373016402339168],
+ [0.13562965393066406, 0.13647060950861248],
+ [0.13763350248336792, 0.13851257866094746],
+ [0.14749455451965332, 0.14857829980464834],
+ [0.1618971824645996, 0.16333433166790448],
+ [0.17051106691360474, 0.17219298693637355],
+ [0.17051833868026733, 0.17220047646299907],
+ [0.18562912940979004, 0.18780647318150087],
+ [0.18898820877075195, 0.1912876932893582],
+ [0.23206615447998047, 0.23637212433914523],
+ [0.23480379581451416, 0.2392675448267427],
+ [0.2646920680999756, 0.27114729033023005],
+ [0.2794986963272095, 0.2871382059344433],
+ [0.28789305686950684, 0.2962673858386819],
+ [0.292596697807312, 0.30140373665239234],
+ [0.3101649284362793, 0.320727882769785],
+ [0.3109246492385864, 0.3215686893944558],
+ [0.31145012378692627, 0.3221505056451929],
+ [0.3271782398223877, 0.3396649461699478],
+ [0.3574345111846924, 0.37394153436545424],
+ [0.3593693971633911, 0.37616159223090223],
+ [0.35960352420806885, 0.37643046596933716],
+ [0.3626827001571655, 0.3799714809649667],
+ [0.38961827754974365, 0.4113499159905353],
+ [0.3904266357421875, 0.41230330080214],
+ [0.3981136083602905, 0.4214052375603139],
+ [0.411507248878479, 0.43742438709579096],
+ [0.4120509624481201, 0.43807911823743495],
+ [0.41868770122528076, 0.4460997186945703],
+ [0.42136549949645996, 0.4493511447897729],
+ [0.4516327381134033, 0.48674948990473677],
+ [0.4538639783859253, 0.4895560176112375],
+ [0.4655507802963257, 0.5043748446613433],
+ [0.48124635219573975, 0.5246050193978663],
+ [0.48621630668640137, 0.5310932154891663],
+ [0.4898730516433716, 0.5358932909903701],
+ [0.5024838447570801, 0.5526234425942533],
+ [0.5074074268341064, 0.5592320547729962],
+ [0.5093221664428711, 0.5618140818296767],
+ [0.5143489837646484, 0.5686253097655146],
+ [0.5154285430908203, 0.5700943191671631],
+ [0.5234100818634033, 0.5810250825991418],
+ [0.5274472236633301, 0.5866018515043636],
+ [0.5309803485870361, 0.5915094458340507],
+ [0.5477793216705322, 0.6152030999229688],
+ [0.5577394962310791, 0.6295459624918965],
+ [0.5582785606384277, 0.6303287742357745],
+ [0.5843560695648193, 0.6690521906099505],
+ [0.5871362686157227, 0.6732844960442398],
+ [0.5878911018371582, 0.6744372167164567],
+ [0.5903406143188477, 0.6781887236623534],
+ [0.5945003032684326, 0.684597775489552],
+ [0.5957975387573242, 0.6866065102131665],
+ [0.5961520671844482, 0.6871563252400655],
+ [0.6005008220672607, 0.6939300827887145],
+ [0.6150004863739014, 0.7169242329194352],
+ [0.6162893772125244, 0.7189998055497108],
+ [0.6194069385528564, 0.7240422748778544],
+ [0.6285066604614258, 0.7389438896054792],
+ [0.6293842792510986, 0.7403958734869583],
+ [0.6416172981262207, 0.7609178886018204],
+ [0.6424276828765869, 0.7622965466812235],
+ [0.6437420845031738, 0.7645378650643101],
+ [0.6468508243560791, 0.769864795178161],
+ [0.6615910530090332, 0.7956379107512945],
+ [0.669950008392334, 0.8106524185805045],
+ [0.6813662052154541, 0.8316597473423232],
+ [0.6968657970428467, 0.8611812790659296],
+ [0.6981887817382812, 0.8637579113749143],
+ [0.7447831630706787, 0.9611360201710216],
+ [0.7518312931060791, 0.9771540941752986],
+ [0.7534394264221191, 0.9808634133542229],
+ [0.7567856311798096, 0.9886489208209699],
+ [0.7817282676696777, 1.0497991719828956],
+ [0.8115026950836182, 1.1314141444187586],
+ [0.814647912979126, 1.1406947755584418],
+ [0.8266689777374268, 1.1775230833699681],
+ [0.8313877582550049, 1.1926138225701433],
+ [0.8343038558959961, 1.2021323323039612],
+ [0.8416652679443359, 1.2268570644335162],
+ [0.8584413528442383, 1.2873896671573652],
+ [0.8678996562957764, 1.3245040433929398],
+ [0.8679344654083252, 1.3246451309261607],
+ [0.8800599575042725, 1.3760334877782177],
+ [0.9003539085388184, 1.4740852961194106],
+ [0.9099440574645996, 1.5271990851861994],
+ [0.9142425060272217, 1.5527768948273004],
+ [0.9149219989776611, 1.556931837197936],
+ [0.9184908866882324, 1.5792896628381612],
+ [0.9188928604125977, 1.5818663359427627],
+ [0.919395923614502, 1.5851082843320008],
+ [0.9296839237213135, 1.6560555223295368],
+ [0.9298396110534668, 1.6572041418041492],
+ [0.9352962970733643, 1.6990986433619266],
+ [0.9376416206359863, 1.718164398807965],
+ [0.9410912990570068, 1.7475084077246632],
+ [0.962122917175293, 1.9737180163455101],
+ [0.9748215675354004, 2.1811227771083783],
+ [0.9769454002380371, 2.2257214499698255],
+ [0.985663890838623, 2.4654635601650536],
+ [0.9880380630493164, 2.5565869228142004],
+ [0.9928233623504639, 2.8132383539094192],
+ [1e-300, 1e-300],
+ [0.00001, 0.000010000000000333334],
+ [0.3, 0.3095196042031117],
+ [1e-30, 1e-30],
+ [1e-10, 1e-10],
+];
+
+var sloppy_tolerance = 2; // FIXME
+
+for (var [x, y] of tanh_data)
+ assertNear(Math.atanh(x), y, sloppy_tolerance);
+
+assertNear(Math.atanh(+3 / 5), +Math.log(2), sloppy_tolerance);
+assertNear(Math.atanh(-3 / 5), -Math.log(2), sloppy_tolerance);
+
+for (var i = -1; i < 1; i += 0.05)
+ assertNear(Math.atanh(Math.tanh(i)), i, sloppy_tolerance);
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/atanh-exact.js b/js/src/tests/non262/Math/atanh-exact.js
new file mode 100644
index 0000000000..f49bdb1ac4
--- /dev/null
+++ b/js/src/tests/non262/Math/atanh-exact.js
@@ -0,0 +1,35 @@
+// Properties of Math.atanh that are guaranteed by the spec.
+
+// If x is NaN, the result is NaN.
+assertEq(Math.atanh(NaN), NaN);
+
+// If x is less than −1, the result is NaN.
+assertEq(Math.atanh(-ONE_PLUS_EPSILON), NaN);
+assertEq(Math.atanh(-Number.MAX_VALUE), NaN);
+assertEq(Math.atanh(-Infinity), NaN);
+
+for (var i = -5; i < -1; i += 0.1)
+ assertEq(Math.atanh(i), NaN);
+
+// If x is greater than 1, the result is NaN.
+assertEq(Math.atanh(ONE_PLUS_EPSILON), NaN);
+assertEq(Math.atanh(Number.MAX_VALUE), NaN);
+assertEq(Math.atanh(Infinity), NaN);
+
+for (var i = +5; i > +1; i -= 0.1)
+ assertEq(Math.atanh(i), NaN);
+
+// If x is −1, the result is −∞.
+assertEq(Math.atanh(-1), -Infinity);
+
+// If x is +1, the result is +∞.
+assertEq(Math.atanh(+1), Infinity);
+
+// If x is +0, the result is +0.
+assertEq(Math.atanh(+0), +0);
+
+// If x is −0, the result is −0.
+assertEq(Math.atanh(-0), -0);
+
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/browser.js b/js/src/tests/non262/Math/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/non262/Math/browser.js
diff --git a/js/src/tests/non262/Math/cbrt-approx.js b/js/src/tests/non262/Math/cbrt-approx.js
new file mode 100644
index 0000000000..1f54bb5a62
--- /dev/null
+++ b/js/src/tests/non262/Math/cbrt-approx.js
@@ -0,0 +1,17 @@
+assertEq(Math.cbrt(1), 1);
+assertEq(Math.cbrt(-1), -1);
+
+assertNear(Math.cbrt(1e-300), 1e-100);
+assertNear(Math.cbrt(-1e-300), -1e-100);
+
+var cbrt_data = [
+ [ Math.E, 1.3956124250860895 ],
+ [ Math.PI, 1.4645918875615231 ],
+ [ Math.LN2, 0.8849970445005177 ],
+ [ Math.SQRT2, 1.1224620483093728 ]
+];
+
+for (var [x, y] of cbrt_data)
+ assertNear(Math.cbrt(x), y);
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/cbrt-exact.js b/js/src/tests/non262/Math/cbrt-exact.js
new file mode 100644
index 0000000000..e0b7289f03
--- /dev/null
+++ b/js/src/tests/non262/Math/cbrt-exact.js
@@ -0,0 +1,19 @@
+// Properties of Math.cbrt that are guaranteed by the spec.
+
+// If x is NaN, the result is NaN.
+assertEq(Math.cbrt(NaN), NaN);
+
+// If x is +0, the result is +0.
+assertEq(Math.cbrt(+0), +0);
+
+// If x is −0, the result is −0.
+assertEq(Math.cbrt(-0), -0);
+
+// If x is +∞, the result is +∞.
+assertEq(Math.cbrt(Infinity), Infinity);
+
+// If x is −∞, the result is −∞.
+assertEq(Math.cbrt(-Infinity), -Infinity);
+
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/clz32.js b/js/src/tests/non262/Math/clz32.js
new file mode 100644
index 0000000000..0062676365
--- /dev/null
+++ b/js/src/tests/non262/Math/clz32.js
@@ -0,0 +1,40 @@
+// Undefined and NaN end up as zero after ToUint32
+assertEq(Math.clz32(), 32);
+assertEq(Math.clz32(NaN), 32);
+assertEq(Math.clz32.call(), 32);
+// 0
+assertEq(Math.clz32(null), 32);
+assertEq(Math.clz32(false), 32);
+// 1
+assertEq(Math.clz32(true), 31);
+// 3
+assertEq(Math.clz32(3.5), 30);
+// NaN -> 0
+assertEq(Math.clz32({}), 32);
+// 2
+assertEq(Math.clz32({valueOf: function() { return 2; }}), 30);
+// 0 -> 0
+assertEq(Math.clz32([]), 32);
+assertEq(Math.clz32(""), 32);
+// NaN -> 0
+assertEq(Math.clz32([1, 2, 3]), 32);
+assertEq(Math.clz32("bar"), 32);
+// 15
+assertEq(Math.clz32("15"), 28);
+
+
+assertEq(Math.clz32(0x80000000), 0);
+assertEq(Math.clz32(0xF0FF1000), 0);
+assertEq(Math.clz32(0x7F8F0001), 1);
+assertEq(Math.clz32(0x3FFF0100), 2);
+assertEq(Math.clz32(0x1FF50010), 3);
+assertEq(Math.clz32(0x00800000), 8);
+assertEq(Math.clz32(0x00400000), 9);
+assertEq(Math.clz32(0x00008000), 16);
+assertEq(Math.clz32(0x00004000), 17);
+assertEq(Math.clz32(0x00000080), 24);
+assertEq(Math.clz32(0x00000040), 25);
+assertEq(Math.clz32(0x00000001), 31);
+assertEq(Math.clz32(0), 32);
+
+reportCompare(0, 0, 'ok');
diff --git a/js/src/tests/non262/Math/cosh-approx.js b/js/src/tests/non262/Math/cosh-approx.js
new file mode 100644
index 0000000000..d724aa2946
--- /dev/null
+++ b/js/src/tests/non262/Math/cosh-approx.js
@@ -0,0 +1,276 @@
+assertEq(Math.cosh(1000), Infinity);
+assertEq(Math.cosh(Number.MAX_VALUE), Infinity);
+assertNear(Math.cosh(1e-30), 1);
+assertNear(Math.cosh(1e-10), 1);
+
+var cosh_data = [
+ [0.0016914556651292944, 1.0000014305114746],
+ [0.001953124689559275, 1.0000019073486328],
+ [0.003782208044661295, 1.000007152557373],
+ [0.005258943946801101, 1.000013828277588],
+ [0.005859366618129203, 1.0000171661376953],
+ [0.010961831992188852, 1.0000600814819336],
+ [0.015285472131830425, 1.0001168251037598],
+ [0.017249319093529877, 1.0001487731933594],
+ [0.028218171738655373, 1.0003981590270996],
+ [0.03573281468231457, 1.000638484954834],
+ [0.046287402472878776, 1.0010714530944824],
+ [0.07771996527168971, 1.0030217170715332],
+ [0.0998975930860278, 1.0049939155578613],
+ [0.13615938768032465, 1.0092840194702148],
+ [0.21942279004958354, 1.024169921875],
+ [0.3511165938166055, 1.0622773170471191],
+ [0.48975026711288183, 1.1223440170288086],
+ [0.692556883708491, 1.2495574951171875],
+ [0.954530572221414, 1.4912219047546387],
+ [1.307581416910453, 1.983847141265869],
+ [1.4035188779741334, 2.1576128005981445],
+ [1.5250070845427517, 2.406397819519043],
+ [1.8905372013072799, 3.386958122253418],
+ [2.1735673399948254, 4.451677322387695],
+ [2.625091127868242, 6.939132690429686],
+ [2.737434918695162, 7.756023406982421],
+ [2.8740317167801948, 8.88236999511719],
+ [2.97998639328949, 9.869171142578123],
+ [3.516549380542481, 16.848876953125],
+ [3.51867003468025, 16.884582519531254],
+ [3.593185165198829, 18.18859100341797],
+ [3.6273672142963385, 18.82012176513672],
+ [3.646553244410946, 19.184181213378906],
+ [3.872413451393967, 24.03952026367187],
+ [3.972085568933329, 26.556991577148434],
+ [4.022209178119238, 27.921104431152337],
+ [4.168428891496629, 32.31466674804686],
+ [4.240546229861005, 34.730087280273445],
+ [4.290698214968891, 36.51556396484376],
+ [4.352722738491574, 38.851287841796875],
+ [4.594386162629449, 49.46875],
+ [4.598500387004538, 49.67265319824219],
+ [4.7152173401856095, 55.821014404296896],
+ [4.73822104001982, 57.119781494140604],
+ [4.793733825338029, 60.37983703613279],
+ [4.8435923769530165, 63.46618652343747],
+ [4.849190310904695, 63.82241821289062],
+ [4.85767897228448, 64.36642456054685],
+ [4.880061548144127, 65.82318115234375],
+ [4.921430721025434, 68.60302734374997],
+ [4.94406835208057, 70.17358398437497],
+ [4.967000841791218, 71.80126953124997],
+ [5.016014824864732, 75.40786743164065],
+ [5.017205657609766, 75.49771118164062],
+ [5.0506448716550825, 78.06475830078126],
+ [5.0707363201405276, 79.64892578125],
+ [5.073517411135063, 79.87072753906253],
+ [5.101574796209937, 82.14324951171874],
+ [5.152357710985635, 86.4221496582031],
+ [5.167705692500117, 87.75869750976562],
+ [5.2390637098028074, 94.24942016601562],
+ [5.247023676519904, 95.00259399414062],
+ [5.258134994273664, 96.06402587890626],
+ [5.289261389093961, 99.10101318359374],
+ [5.345425863147171, 104.82595825195315],
+ [5.3555664787245885, 105.89431762695308],
+ [5.363617180711895, 106.750244140625],
+ [5.388152468690488, 109.40167236328122],
+ [5.405320225963013, 111.2959899902344],
+ [5.417698597745429, 112.68215942382815],
+ [5.445406415908933, 115.8478698730469],
+ [5.501396249028249, 122.51895141601562],
+ [5.531718947357248, 126.29083251953128],
+ [5.544277233951787, 127.88677978515626],
+ [5.547444176085567, 128.29241943359372],
+ [5.556786759298988, 129.49658203125006],
+ [5.625710723366437, 138.7365112304687],
+ [5.628934733085022, 139.18450927734378],
+ [5.634566685055491, 139.97058105468747],
+ [5.660401141376928, 143.63366699218747],
+ [5.698541939965668, 149.21765136718753],
+ [5.7078698961812995, 150.6160278320313],
+ [5.714741890601693, 151.6546020507813],
+ [5.735111323217677, 154.77532958984378],
+ [5.761781191641161, 158.95861816406253],
+ [5.763503378028959, 159.23260498046878],
+ [5.810483079631769, 166.89166259765622],
+ [5.824362807770767, 169.22418212890625],
+ [5.833939098607025, 170.85247802734372],
+ [5.861586030831371, 175.64184570312503],
+ [5.866335876872544, 176.47808837890625],
+ [5.869449614294116, 177.02844238281247],
+ [5.879497954012966, 178.81622314453122],
+ [5.893213844044451, 181.28570556640625],
+ [5.944588630523773, 190.84246826171866],
+ [5.947493525920713, 191.39764404296875],
+ [5.962341215900494, 194.26062011718753],
+ [5.9656082276276, 194.89630126953122],
+ [5.9749284849312865, 196.7212524414062],
+ [5.975165500176202, 196.76788330078128],
+ [5.981706804024238, 198.05920410156241],
+ [5.991310884439669, 199.9705200195312],
+ [6.004868209578554, 202.70001220703122],
+ [6.0159406892865155, 204.95684814453116],
+ [6.025476453825986, 206.92059326171866],
+ [6.047172064627678, 211.45886230468741],
+ [6.0479418642231595, 211.62170410156256],
+ [6.050479329955437, 212.1593627929687],
+ [6.086466833749719, 219.93341064453125],
+ [6.101870903204913, 223.3474731445312],
+ [6.1249427443985525, 228.56036376953128],
+ [6.129204755426344, 229.53656005859375],
+ [6.136241935513706, 231.1575317382813],
+ [6.153688953514383, 235.22589111328134],
+ [6.1619244798633215, 237.17108154296884],
+ [6.165012268502458, 237.90454101562506],
+ [6.187036941752032, 243.202392578125],
+ [6.191527178125454, 244.29687500000003],
+ [6.196001570568187, 245.3923950195312],
+ [6.197677082130341, 245.80389404296875],
+ [6.2133379061260285, 249.68365478515622],
+ [6.223871642756905, 252.3276367187501],
+ [6.228398760115369, 253.47253417968756],
+ [6.269692237869835, 264.1583251953126],
+ [6.276143287577458, 265.8679199218749],
+ [6.305884283737176, 273.89379882812494],
+ [6.306492908028797, 274.0605468750001],
+ [6.3065018163217115, 274.06298828125006],
+ [6.31104892482331, 275.3120117187501],
+ [6.3322712125431915, 281.2171630859374],
+ [6.343324976847916, 284.34289550781244],
+ [6.345081883725142, 284.84289550781256],
+ [6.353683609448096, 287.30358886718756],
+ [6.366114643735997, 290.8973388671876],
+ [6.373476431987165, 293.0467529296875],
+ [6.3734826803404045, 293.04858398437494],
+ [6.3862671775996915, 296.819091796875],
+ [6.389086936901673, 297.6572265625],
+ [6.424562459508495, 308.4062500000001],
+ [6.4506171773701535, 316.5472412109376],
+ [6.462221144761522, 320.24182128906256],
+ [6.468740575092418, 322.33642578125],
+ [6.472375224718483, 323.5101318359374],
+ [6.485834999462654, 327.8939208984375],
+ [6.486412623146554, 328.08337402343744],
+ [6.486812521370483, 328.214599609375],
+ [6.498698952535687, 332.1391601562501],
+ [6.521175044233963, 339.6888427734376],
+ [6.522595306993373, 340.171630859375],
+ [6.522766822935215, 340.2299804687499],
+ [6.52502285413445, 340.99841308593744],
+ [6.5445411825986985, 347.7194824218749],
+ [6.5451209675856825, 347.9211425781249],
+ [6.55061885367159, 349.8392333984375],
+ [6.560126626713879, 353.1812744140626],
+ [6.560510895819139, 353.31701660156244],
+ [6.565186990039135, 354.97302246093756],
+ [6.567067660815945, 355.64123535156233],
+ [6.588081320423386, 363.19360351562517],
+ [6.5896131163651415, 363.7503662109376],
+ [6.597598047275183, 366.66650390624983],
+ [6.608222493065004, 370.5828857421874],
+ [6.611563301604297, 371.822998046875],
+ [6.622421213257873, 375.88220214843756],
+ [6.625684248051368, 377.11071777343744],
+ [6.626950731244344, 377.58862304687483],
+ [6.630267034079059, 378.8428955078124],
+ [6.630977920761718, 379.11230468749994],
+ [6.636217452968849, 381.10388183593756],
+ [6.638857149899159, 382.1112060546874],
+ [6.641161660644278, 382.9927978515625],
+ [6.652047018118426, 387.1845703124999],
+ [6.658445560711748, 389.66992187499994],
+ [6.658790721334144, 389.8044433593749],
+ [6.675345858154136, 396.3114013671875],
+ [6.677094789236718, 397.00512695312494],
+ [6.6775691166680895, 397.1934814453124],
+ [6.679106750673113, 397.80468749999994],
+ [6.681712590609845, 398.84265136718744],
+ [6.682523938576487, 399.16638183593744],
+ [6.68274532345516, 399.2547607421874],
+ [6.685459416477178, 400.3398437499999],
+ [6.694456277839498, 403.9578857421875],
+ [6.6952522228540765, 404.27954101562517],
+ [6.6971746771142415, 405.05749511718744],
+ [6.702764738337774, 407.328125],
+ [6.7033022311799595, 407.54711914062506],
+ [6.710763953621196, 410.59948730468756],
+ [6.711256159037373, 410.8016357421876],
+ [6.712054288828399, 411.12963867187494],
+ [6.713939407502346, 411.9053955078124],
+ [6.722828986708716, 415.5833740234374],
+ [6.727835453862132, 417.66918945312506],
+ [6.734632628835641, 420.51782226562506],
+ [6.743787740494532, 424.38537597656233],
+ [6.744565219553757, 424.71545410156244],
+ [6.7715720212680655, 436.3419189453125],
+ [6.776510146304201, 438.50195312500017],
+ [6.778412462065226, 439.33691406250017],
+ [6.79247934060035, 445.5606689453126],
+ [6.809016260337229, 452.9901123046875],
+ [6.810747231716348, 453.7749023437499],
+ [6.817335895109251, 456.7745361328125],
+ [6.819910421197311, 457.9520263671875],
+ [6.821497844004013, 458.6795654296874],
+ [6.8254946428721475, 460.51647949218767],
+ [6.828433164406687, 461.87170410156256],
+ [6.834543470287694, 464.70251464843756],
+ [6.839609377592375, 467.06262207031267],
+ [6.839627933844213, 467.0712890625001],
+ [6.846084943645239, 470.09692382812494],
+ [6.856799276049143, 475.16076660156233],
+ [6.861822721577315, 477.5537109374998],
+ [6.864066049482581, 478.62622070312517],
+ [6.864420497333681, 478.79589843750017],
+ [6.866278653973069, 479.68640136718733],
+ [6.866487814627139, 479.7867431640625],
+ [6.8667493311188395, 479.9122314453126],
+ [6.872084270243208, 482.4793701171875],
+ [6.872164723177875, 482.5181884765627],
+ [6.874982560453874, 483.87976074218767],
+ [6.876191234145179, 484.46496582031233],
+ [6.877966548833207, 485.3258056640624],
+ [6.888721726428236, 490.57373046875006],
+ [6.89515989558997, 493.74230957031244],
+ [6.896232568812718, 494.2722167968751],
+ [6.900624415355815, 496.44775390624983],
+ [6.901816998553275, 497.0401611328125],
+ [6.9042162822876465, 498.23413085937483],
+ [7.193052598670793, 665.0791015625001],
+ [7.758155143419732, 1170.29150390625],
+ [8.323023697145112, 2058.795898437501],
+ [9.36298131161099, 5824.533203125004],
+ [9.810748008110926, 9114.308593750004],
+ [11.047341056314202, 31388.40624999998],
+ [11.584925435512535, 53732.765624999956],
+ [12.366958539207397, 117455.0937500001],
+ [13.107089828327874, 246210.62499999983],
+ [13.84248373881162, 513670.1250000003],
+ [14.27084873575108, 788353.2499999999],
+ [15.060339852215408, 1736170.999999999],
+ [15.835873313657556, 3770530.0000000005],
+ [15.977474039173265, 4344089.999999998],
+ [16.943967899150145, 11419360.000000006],
+ [17.943394339560967, 31023239.99999997],
+ [18.214035936745432, 40665424.00000006],
+ [19.374560581709215, 129788063.99999991],
+ [19.927723623778547, 225668224.00000027],
+ [20.619308638400597, 450631936.0000006],
+ [21.129986093026698, 750941952.0000008],
+ [22.05159150215413, 1887358976.0000033],
+ [22.734966842639743, 3738011648.0000052],
+ [23.42954051928097, 7486695423.99999],
+ [23.955498471391667, 12668080127.99998],
+ [24.591055724582848, 23918272512],
+ [25.305424481799395, 48862560256.00005],
+ [26.150535181949436, 113763549183.99998],
+ [26.499894449532565, 161334755328.00018],
+ [27.19075733422632, 321933279232.0004],
+ [27.989721778208146, 715734122496],
+ [28.953212876533797, 1875817529343.9976],
+];
+
+for (var [x, y] of cosh_data)
+ assertNear(Math.cosh(x), y);
+
+for (var i = -20; i < 20; i++)
+ assertNear(Math.cosh(i), (Math.exp(i) + Math.exp(-i)) / 2);
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/cosh-exact.js b/js/src/tests/non262/Math/cosh-exact.js
new file mode 100644
index 0000000000..a302776c4f
--- /dev/null
+++ b/js/src/tests/non262/Math/cosh-exact.js
@@ -0,0 +1,19 @@
+// Properties of Math.cosh that are guaranteed by the spec.
+
+// If x is NaN, the result is NaN.
+assertEq(Math.cosh(NaN), NaN);
+
+// If x is +0, the result is 1.
+assertEq(Math.cosh(+0), 1);
+
+// If x is −0, the result is 1.
+assertEq(Math.cosh(-0), 1);
+
+// If x is +∞, the result is +∞.
+assertEq(Math.cosh(Infinity), Infinity);
+
+// If x is −∞, the result is +∞.
+assertEq(Math.cosh(-Infinity), Infinity);
+
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/exp-exact.js b/js/src/tests/non262/Math/exp-exact.js
new file mode 100644
index 0000000000..e004f74718
--- /dev/null
+++ b/js/src/tests/non262/Math/exp-exact.js
@@ -0,0 +1,29 @@
+// Properties of Math.exp that are guaranteed by the spec.
+
+// If x is NaN, the result is NaN.
+assertEq(Math.exp(NaN), NaN);
+
+// If x is +0, the result is 1.
+assertEq(Math.exp(+0), 1);
+
+// If x is −0, the result is 1.
+assertEq(Math.exp(-0), 1);
+
+// If x is +∞, the result is +∞.
+assertEq(Math.exp(Infinity), Infinity);
+
+// If x is −∞, the result is +0.
+assertEq(Math.exp(-Infinity), +0);
+
+
+// Not guaranteed by the specification, but generally assumed to hold.
+
+// If x is 1, the result is Math.E.
+assertEq(Math.exp(1), Math.E);
+
+// If x is -1, the result is 1/Math.E.
+assertEq(Math.exp(-1), 1 / Math.E);
+
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/non262/Math/expm1-approx.js b/js/src/tests/non262/Math/expm1-approx.js
new file mode 100644
index 0000000000..397ab97ebf
--- /dev/null
+++ b/js/src/tests/non262/Math/expm1-approx.js
@@ -0,0 +1,62 @@
+assertNear(Math.expm1(1e-300), 1e-300);
+assertNear(Math.expm1(1e-100), 1e-100);
+assertNear(Math.expm1(1e-14), 1.000000000000005e-14);
+assertNear(Math.expm1(1e-6), 0.0000010000005000001665);
+
+var expm1_data = [
+ [ -1.875817529344e-70, -1.875817529344e-70 ],
+ [ -7.09962844069878e-15, -7.099628440698755e-15 ],
+ [ -2.114990849122478e-10, -2.1149908488988187e-10 ],
+ [ -0.0000031404608812881633, -0.000003140455950046052 ],
+
+ [ -0.0000011039855962733358, -0.0000011039849868814618 ],
+ [ -0.000015114666893502755, -0.0000151145526675006 ],
+ [ -0.000033870281179478836, -0.000033869707587981166 ],
+ [ -0.00043952149320897676, -0.00043942491778698985 ],
+ [ -0.005553725496786973, -0.005538332073473123 ],
+ [ -0.05122020579778827, -0.049930563302241604 ],
+ [ -0.4721357117742938, -0.3763311320344197 ],
+ [ -1.2781607348262256, -0.7214508446489242 ],
+
+ [ 1.875817529344e-70, 1.875817529344e-70 ],
+ [ 6.261923313140869e-30, 6.261923313140869e-30 ],
+ [ 7.09962844069878e-15, 7.099628440698805e-15 ],
+ [ 1.3671879628418538e-12, 1.3671879628427884e-12 ],
+ [ 2.114990849122478e-10, 2.1149908493461373e-10 ],
+ [ 1.6900931765206906e-8, 1.6900931908027652e-8 ],
+ [ 0.0000031404608812881633, 0.0000031404658125405988 ],
+
+ [ 0.0000011039855962733358, 0.0000011039862056656584 ],
+ [ 0.000015114666893502755, 0.000015114781120655907 ],
+ [ 0.000033870281179478836, 0.00003387085478392845 ],
+ [ 0.00043952149320897676, 0.0004396180969330924 ],
+ [ 0.005553725496786973, 0.005569176019645543 ],
+ [ 0.05122020579778827, 0.05255464640120383 ],
+ [ 0.4721357117742938, 0.6034149712523235 ],
+ [ 1.2781607348262256, 2.590030631181154 ],
+
+ [ 3.0693960800487883, 20.528897017773147 ],
+ [ 5.560441648750136, 258.9376120972927 ],
+ [ 7.4227656046482595, 1672.6557833191303 ],
+ [ 11.378926299184645, 87458.07941992789 ],
+];
+
+for (var [x, y] of expm1_data)
+ assertNear(Math.expm1(x), y);
+
+var sloppy_tolerance = 34;
+
+var expm1_data_sloppy = [
+ [ 20.11881628179155, 546375092.2355127 ],
+ [ 33.45034324980283, 336743709091858.2 ],
+ [ 46.43974518513109, 147409364838076710000 ],
+ [ 54.60105936314322, 5.163435870507142e+23 ],
+ [ 84.29619209850242, 4.067907545704549e+36 ],
+ [ 125.38131800315817, 2.8340959047812913e+54 ],
+ [ 216.85489905212918, 1.5096839294759775e+94 ],
+];
+
+for (var [x, y] of expm1_data_sloppy)
+ assertNear(Math.expm1(x), y, sloppy_tolerance);
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/expm1-exact.js b/js/src/tests/non262/Math/expm1-exact.js
new file mode 100644
index 0000000000..57b94ed225
--- /dev/null
+++ b/js/src/tests/non262/Math/expm1-exact.js
@@ -0,0 +1,20 @@
+// Properties of Math.expm1 that are guaranteed by the spec.
+
+// If x is NaN, the result is NaN.
+assertEq(Math.expm1(NaN), NaN);
+
+// If x is +0, the result is +0.
+assertEq(Math.expm1(+0), +0);
+
+// If x is −0, the result is −0.
+assertEq(Math.expm1(-0), -0);
+
+// If x is +∞, the result is +∞.
+assertEq(Math.expm1(Infinity), Infinity);
+
+// If x is −∞, the result is -1.
+assertEq(Math.expm1(-Infinity), -1);
+
+
+reportCompare(0, 0, "ok");
+
diff --git a/js/src/tests/non262/Math/expm1-monotonicity.js b/js/src/tests/non262/Math/expm1-monotonicity.js
new file mode 100644
index 0000000000..2ae25708d1
--- /dev/null
+++ b/js/src/tests/non262/Math/expm1-monotonicity.js
@@ -0,0 +1,94 @@
+var BUGNUMBER = 897634;
+var summary = "expm1 should be monotonically increasing";
+
+print(BUGNUMBER + ": " + summary);
+
+function test(x, prev, next) {
+ assertEq(Math.expm1(prev) <= Math.expm1(x), true);
+ assertEq(Math.expm1(x) <= Math.expm1(next), true);
+}
+
+// Thresholds in fdlibm expm1 implementation.
+
+// |hx| == 0x40862E42 or not
+test(-709.7822265625, -709.7822265625001, -709.7822265624999);
+test(709.7822265625, 709.7822265624999, 709.7822265625001);
+
+// |hx| == 0x4043687A or not
+test(-38.81622314453125, -38.81622314453126, -38.81622314453124);
+test(38.81622314453125, 38.81622314453124, 38.81622314453126);
+
+// |hx| == 0x7ff00000 or not
+test(-1.7976931348623157e+308, -Infinity, -1.7976931348623155e+308);
+test(1.7976931348623157e+308, 1.7976931348623155e+308, Infinity);
+
+// |hx| == 0x3fd62e42 or not
+test(-0.3465733528137207, -0.34657335281372076, -0.34657335281372065);
+test(0.3465733528137207, 0.34657335281372065, 0.34657335281372076);
+
+// |hx| == 0x3FF0A2B2 or not
+test(-1.0397205352783203, -1.0397205352783205, -1.03972053527832);
+test(1.0397205352783203, 1.03972053527832, 1.0397205352783205);
+
+// |hx| == 0x3c900000 or not
+test(-5.551115123125783e-17, -5.551115123125784e-17, -5.551115123125782e-17);
+test(5.551115123125783e-17, 5.551115123125782e-17, 5.551115123125784e-17);
+
+// x < -0.25 or not
+test(-0.25, -0.25000000000000006, -0.24999999999999997);
+
+// k == -1 or k == -2
+test(-1.0397207708399179, -1.039720770839918, -1.0397207708399177);
+
+// k == -1 or k == 0
+test(-0.3465735912322998, -0.34657359123229986, -0.34657359123229975);
+
+// k == 0 or k == 1
+test(0.3465735912322998, 0.34657359123229975, 0.34657359123229986);
+
+// k == 1 or k == 2
+test(1.039720770839918, 1.0397207708399179, 1.0397207708399183);
+
+// k == 19 or k == 20
+test(13.516370020918933, 13.51637002091893, 13.516370020918934);
+
+// k == 56 or k == 57
+test(39.16281570163691, 39.1628157016369, 39.162815701636916);
+
+// k == 1023 or k == 1024
+test(709.436139303104, 709.4361393031039, 709.4361393031041);
+
+// k == 1024 or more
+test(709.7827128933841, 709.782712893384, 709.7827128933842);
+
+// Some more random cases.
+test(-1.7976931348623157e+308, -Infinity, -1.7976931348623155e+308);
+test(-1e+223, -1.0000000000000002e+223, -9.999999999999999e+222);
+test(-1e+100, -1.0000000000000002e+100, -9.999999999999998e+99);
+test(-10000000000, -10000000000.000002, -9999999999.999998);
+test(-100000, -100000.00000000001, -99999.99999999999);
+test(-100, -100.00000000000001, -99.99999999999999);
+test(-10, -10.000000000000002, -9.999999999999998);
+test(-1, -1, -0.9999999999999999);
+test(-0.01, -0.010000000000000002, -0.009999999999999998);
+test(-0.00001, -0.000010000000000000003, -0.000009999999999999999);
+test(-1e-10, -1.0000000000000002e-10, -9.999999999999999e-11);
+test(-1e-100, -1.0000000000000001e-100, -9.999999999999999e-101);
+test(-5e-324, -1e-323, 0);
+test(0, -5e-324, 5e-324);
+test(5e-324, 0, 1e-323);
+test(1e-100, 9.999999999999999e-101, 1.0000000000000001e-100);
+test(1e-10, 9.999999999999999e-11, 1.0000000000000002e-10);
+test(0.00001, 0.000009999999999999999, 0.000010000000000000003);
+test(0.01, 0.009999999999999998, 0.010000000000000002);
+test(1, 0.9999999999999999, 1);
+test(10, 9.999999999999998, 10.000000000000002);
+test(100, 99.99999999999999, 100.00000000000001);
+test(100000, 99999.99999999999, 100000.00000000001);
+test(10000000000, 9999999999.999998, 10000000000.000002);
+test(1e+100, 9.999999999999998e+99, 1.0000000000000002e+100);
+test(1e+223, 9.999999999999999e+222, 1.0000000000000002e+223);
+test(1.7976931348623157e+308, 1.7976931348623155e+308, Infinity);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/non262/Math/fround.js b/js/src/tests/non262/Math/fround.js
new file mode 100644
index 0000000000..353f798d5d
--- /dev/null
+++ b/js/src/tests/non262/Math/fround.js
@@ -0,0 +1,81 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+// Some tests regarding conversion to Float32
+assertEq(Math.fround(), NaN);
+
+// Special values
+assertEq(Math.fround(NaN), NaN);
+assertEq(Math.fround(-Infinity), -Infinity);
+assertEq(Math.fround(Infinity), Infinity);
+assertEq(Math.fround(-0), -0);
+assertEq(Math.fround(+0), +0);
+
+// Polyfill function for Float32 conversion
+var toFloat32 = (function() {
+ var f32 = new Float32Array(1);
+ function f(x) {
+ f32[0] = x;
+ return f32[0];
+ }
+ return f;
+})();
+
+// A test on a certain range of numbers, including big numbers, so that
+// we get a loss in precision for some of them.
+for (var i = 0; i < 64; ++i) {
+ var p = Math.pow(2, i) + 1;
+ assertEq(Math.fround(p), toFloat32(p));
+ assertEq(Math.fround(-p), toFloat32(-p));
+}
+
+/********************************************
+/* Tests on maximal Float32 / Double values *
+/*******************************************/
+function maxValue(exponentWidth, significandWidth) {
+ var n = 0;
+ var maxExp = Math.pow(2, exponentWidth - 1) - 1;
+ for (var i = significandWidth; i >= 0; i--)
+ n += Math.pow(2, maxExp - i);
+ return n;
+}
+
+var DBL_MAX = maxValue(11, 52);
+assertEq(DBL_MAX, Number.MAX_VALUE); // sanity check
+
+// Finite as a double, too big for a float
+assertEq(Math.fround(DBL_MAX), Infinity);
+
+var FLT_MAX = maxValue(8, 23);
+assertEq(Math.fround(FLT_MAX), FLT_MAX);
+assertEq(Math.fround(FLT_MAX + Math.pow(2, Math.pow(2, 8 - 1) - 1 - 23 - 2)), FLT_MAX); // round-nearest rounds down to FLT_MAX
+assertEq(Math.fround(FLT_MAX + Math.pow(2, Math.pow(2, 8 - 1) - 1 - 23 - 1)), Infinity); // no longer rounds down to FLT_MAX
+
+/*********************************************************
+/******* Tests on denormalizations and roundings *********
+/********************************************************/
+
+function minValue(exponentWidth, significandWidth) {
+ return Math.pow(2, -(Math.pow(2, exponentWidth - 1) - 2) - significandWidth);
+}
+
+var DBL_MIN = Math.pow(2, -1074);
+assertEq(DBL_MIN, Number.MIN_VALUE); // sanity check
+
+// Too small for a float
+assertEq(Math.fround(DBL_MIN), 0);
+
+var FLT_MIN = minValue(8, 23);
+assertEq(Math.fround(FLT_MIN), FLT_MIN);
+
+assertEq(Math.fround(FLT_MIN / 2), 0); // halfway, round-nearest rounds down to 0 (even)
+assertEq(Math.fround(FLT_MIN / 2 + Math.pow(2, -202)), FLT_MIN); // first double > FLT_MIN / 2, rounds up to FLT_MIN
+
+assertEq(Math.fround(-FLT_MIN), -FLT_MIN);
+
+assertEq(Math.fround(-FLT_MIN / 2), -0); // halfway, round-nearest rounds up to -0 (even)
+assertEq(Math.fround(-FLT_MIN / 2 - Math.pow(2, -202)), -FLT_MIN); // first double < -FLT_MIN / 2, rounds down to -FLT_MIN
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/log10-approx.js b/js/src/tests/non262/Math/log10-approx.js
new file mode 100644
index 0000000000..0489448513
--- /dev/null
+++ b/js/src/tests/non262/Math/log10-approx.js
@@ -0,0 +1,9 @@
+assertNear(Math.log10(2), 0.3010299956639812);
+assertNear(Math.log10(7), 0.8450980400142568);
+assertNear(Math.log10(Math.E), Math.LOG10E);
+
+for (var i = -10; i < 10; i++)
+ assertNear(Math.log10(Math.pow(10, i)), i);
+
+reportCompare(0, 0, 'ok');
+
diff --git a/js/src/tests/non262/Math/log10-exact.js b/js/src/tests/non262/Math/log10-exact.js
new file mode 100644
index 0000000000..0c125306bf
--- /dev/null
+++ b/js/src/tests/non262/Math/log10-exact.js
@@ -0,0 +1,30 @@
+// Properties of Math.log10 that are guaranteed by the spec.
+
+// If x is NaN, the result is NaN.
+assertEq(Math.log10(NaN), NaN);
+
+// If x is less than 0, the result is NaN.
+assertEq(Math.log10(-1e-10), NaN);
+assertEq(Math.log10(-1e-5), NaN);
+assertEq(Math.log10(-1e-1), NaN);
+assertEq(Math.log10(-Number.MIN_VALUE), NaN);
+assertEq(Math.log10(-Number.MAX_VALUE), NaN);
+assertEq(Math.log10(-Infinity), NaN);
+
+for (var i = -1; i > -10; i--)
+ assertEq(Math.log10(i), NaN);
+
+// If x is +0, the result is −∞.
+assertEq(Math.log10(+0), -Infinity);
+
+// If x is −0, the result is −∞.
+assertEq(Math.log10(-0), -Infinity);
+
+// If x is 1, the result is +0.
+assertEq(Math.log10(1), +0);
+
+// If x is +∞, the result is +∞.
+assertEq(Math.log10(Infinity), Infinity);
+
+
+reportCompare(0, 0, 'ok');
diff --git a/js/src/tests/non262/Math/log1p-approx.js b/js/src/tests/non262/Math/log1p-approx.js
new file mode 100644
index 0000000000..f1d120af68
--- /dev/null
+++ b/js/src/tests/non262/Math/log1p-approx.js
@@ -0,0 +1,20 @@
+assertNear(Math.log1p(1e-300), 1e-300);
+assertNear(Math.log1p(1e-15), 9.999999999999995e-16);
+assertNear(Math.log1p(1e-6), 9.999995000003334e-7);
+
+var log1p_data = [
+ [ 1.875817529344e-70, 1.875817529344e-70 ],
+ [ 6.261923313140869e-30, 6.261923313140869e-30 ],
+ [ 7.09962844069878e-15, 7.099628440698755e-15 ],
+ [ 1.3671879628418538e-12, 1.3671879628409192e-12 ],
+ [ 2.114990849122478e-10, 2.1149908488988187e-10 ],
+ [ 1.6900931765206906e-8, 1.690093162238616e-8 ],
+ [ 0.0000709962844069878, 0.00007099376429006658 ],
+ [ 0.0016793412882520897, 0.00167793277137076 ],
+ [ 0.011404608812881634, 0.011340066517988035 ],
+];
+
+for (var [x, y] of log1p_data)
+ assertNear(Math.log1p(x), y);
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/log1p-exact.js b/js/src/tests/non262/Math/log1p-exact.js
new file mode 100644
index 0000000000..bec11b6597
--- /dev/null
+++ b/js/src/tests/non262/Math/log1p-exact.js
@@ -0,0 +1,29 @@
+// Properties of Math.log1p that are guaranteed by the spec.
+
+// If x is NaN, the result is NaN.
+assertEq(Math.log1p(NaN), NaN);
+
+// If x is less than -1, the result is NaN.
+assertEq(Math.log1p(-1 - 1e-10), NaN);
+assertEq(Math.log1p(-1 - 1e-5), NaN);
+assertEq(Math.log1p(-1 - 1e-1), NaN);
+assertEq(Math.log1p(-ONE_PLUS_EPSILON), NaN);
+
+for (var i = -2; i > -20; i--)
+ assertEq(Math.log1p(i), NaN);
+
+// If x is -1, the result is -∞.
+assertEq(Math.log1p(-1), -Infinity);
+
+// If x is +0, the result is +0.
+assertEq(Math.log1p(+0), +0);
+
+// If x is −0, the result is −0.
+assertEq(Math.log1p(-0), -0);
+
+// If x is +∞, the result is +∞.
+assertEq(Math.log1p(Infinity), Infinity);
+
+
+reportCompare(0, 0, "ok");
+
diff --git a/js/src/tests/non262/Math/log2-approx.js b/js/src/tests/non262/Math/log2-approx.js
new file mode 100644
index 0000000000..954f4c1cf9
--- /dev/null
+++ b/js/src/tests/non262/Math/log2-approx.js
@@ -0,0 +1,8 @@
+for (var i = -1074; i < 1023; i++)
+ assertNear(Math.log2(Math.pow(2, i)), i);
+
+assertNear(Math.log2(5), 2.321928094887362);
+assertNear(Math.log2(7), 2.807354922057604);
+assertNear(Math.log2(Math.E), Math.LOG2E);
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/log2-exact.js b/js/src/tests/non262/Math/log2-exact.js
new file mode 100644
index 0000000000..160034ddb8
--- /dev/null
+++ b/js/src/tests/non262/Math/log2-exact.js
@@ -0,0 +1,30 @@
+// Properties of Math.log2 that are guaranteed by the spec.
+
+// If x is NaN, the result is NaN.
+assertEq(Math.log2(NaN), NaN);
+
+// If x is less than 0, the result is NaN.
+assertEq(Math.log2(-1e-10), NaN);
+assertEq(Math.log2(-1e-5), NaN);
+assertEq(Math.log2(-1e-1), NaN);
+assertEq(Math.log2(-Number.MIN_VALUE), NaN);
+assertEq(Math.log2(-Number.MAX_VALUE), NaN);
+assertEq(Math.log2(-Infinity), NaN);
+
+for (var i = -1; i > -10; i--)
+ assertEq(Math.log2(i), NaN);
+
+// If x is +0, the result is −∞.
+assertEq(Math.log2(+0), -Infinity);
+
+// If x is −0, the result is −∞.
+assertEq(Math.log2(-0), -Infinity);
+
+// If x is 1, the result is +0.
+assertEq(Math.log2(1), +0);
+
+// If x is +∞, the result is +∞.
+assertEq(Math.log2(Infinity), Infinity);
+
+
+reportCompare(0, 0, 'ok');
diff --git a/js/src/tests/non262/Math/shell.js b/js/src/tests/non262/Math/shell.js
new file mode 100644
index 0000000000..7a64eccac9
--- /dev/null
+++ b/js/src/tests/non262/Math/shell.js
@@ -0,0 +1,74 @@
+// The nearest representable values to +1.0.
+const ONE_PLUS_EPSILON = 1 + Math.pow(2, -52); // 0.9999999999999999
+const ONE_MINUS_EPSILON = 1 - Math.pow(2, -53); // 1.0000000000000002
+
+{
+ const fail = function (msg) {
+ var exc = new Error(msg);
+ try {
+ // Try to improve on exc.fileName and .lineNumber; leave exc.stack
+ // alone. We skip two frames: fail() and its caller, an assertX()
+ // function.
+ var frames = exc.stack.trim().split("\n");
+ if (frames.length > 2) {
+ var m = /@([^@:]*):([0-9]+)$/.exec(frames[2]);
+ if (m) {
+ exc.fileName = m[1];
+ exc.lineNumber = +m[2];
+ }
+ }
+ } catch (ignore) { throw ignore;}
+ throw exc;
+ };
+
+ let ENDIAN; // 0 for little-endian, 1 for big-endian.
+
+ // Return the difference between the IEEE 754 bit-patterns for a and b.
+ //
+ // This is meaningful when a and b are both finite and have the same
+ // sign. Then the following hold:
+ //
+ // * If a === b, then diff(a, b) === 0.
+ //
+ // * If a !== b, then diff(a, b) === 1 + the number of representable values
+ // between a and b.
+ //
+ const f = new Float64Array([0, 0]);
+ const u = new Uint32Array(f.buffer);
+ const diff = function (a, b) {
+ f[0] = a;
+ f[1] = b;
+ //print(u[1].toString(16) + u[0].toString(16) + " " + u[3].toString(16) + u[2].toString(16));
+ return Math.abs((u[3-ENDIAN] - u[1-ENDIAN]) * 0x100000000 + u[2+ENDIAN] - u[0+ENDIAN]);
+ };
+
+ // Set ENDIAN to the platform's endianness.
+ ENDIAN = 0; // try little-endian first
+ if (diff(2, 4) === 0x100000) // exact wrong answer we'll get on a big-endian platform
+ ENDIAN = 1;
+ assertEq(diff(2,4), 0x10000000000000);
+ assertEq(diff(0, Number.MIN_VALUE), 1);
+ assertEq(diff(1, ONE_PLUS_EPSILON), 1);
+ assertEq(diff(1, ONE_MINUS_EPSILON), 1);
+
+ var assertNear = function assertNear(a, b, tolerance=1) {
+ if (!Number.isFinite(b)) {
+ fail("second argument to assertNear (expected value) must be a finite number");
+ } else if (Number.isNaN(a)) {
+ fail("got NaN, expected a number near " + b);
+ } else if (!Number.isFinite(a)) {
+ if (b * Math.sign(a) < Number.MAX_VALUE)
+ fail("got " + a + ", expected a number near " + b);
+ } else {
+ // When the two arguments do not have the same sign bit, diff()
+ // returns some huge number. So if b is positive or negative 0,
+ // make target the zero that has the same sign bit as a.
+ var target = b === 0 ? a * 0 : b;
+ var err = diff(a, target);
+ if (err > tolerance) {
+ fail("got " + a + ", expected a number near " + b +
+ " (relative error: " + err + ")");
+ }
+ }
+ };
+}
diff --git a/js/src/tests/non262/Math/sign.js b/js/src/tests/non262/Math/sign.js
new file mode 100644
index 0000000000..5552dfc3d4
--- /dev/null
+++ b/js/src/tests/non262/Math/sign.js
@@ -0,0 +1,34 @@
+// If x is NaN, the result is NaN.
+assertEq(Math.sign(NaN), NaN);
+
+// If x is −0, the result is −0.
+assertEq(Math.sign(-0), -0);
+
+// If x is +0, the result is +0.
+assertEq(Math.sign(+0), +0);
+
+// If x is negative and not −0, the result is −1.
+assertEq(Math.sign(-Number.MIN_VALUE), -1);
+assertEq(Math.sign(-Number.MAX_VALUE), -1);
+assertEq(Math.sign(-Infinity), -1);
+
+for (var i = -1; i > -20; i--)
+ assertEq(Math.sign(i), -1);
+
+assertEq(Math.sign(-1e-300), -1);
+assertEq(Math.sign(-0x80000000), -1);
+
+// If x is positive and not +0, the result is +1.
+assertEq(Math.sign(Number.MIN_VALUE), +1);
+assertEq(Math.sign(Number.MAX_VALUE), +1);
+assertEq(Math.sign(Infinity), +1);
+
+for (var i = 1; i < 20; i++)
+ assertEq(Math.sign(i), +1);
+
+assertEq(Math.sign(+1e-300), +1);
+assertEq(Math.sign(0x80000000), +1);
+assertEq(Math.sign(0xffffffff), +1);
+
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/sinh-approx.js b/js/src/tests/non262/Math/sinh-approx.js
new file mode 100644
index 0000000000..15170dc666
--- /dev/null
+++ b/js/src/tests/non262/Math/sinh-approx.js
@@ -0,0 +1,297 @@
+for (var i = -20; i < 20; i++)
+ assertNear(Math.sinh(i), (Math.exp(i) - Math.exp(-i)) / 2);
+
+assertEq(Math.sinh(1000), Infinity);
+assertEq(Math.sinh(Number.MAX_VALUE), Infinity);
+assertNear(Math.sinh(1e-30), 1e-30);
+assertNear(Math.sinh(1e-10), 1e-10);
+
+var sinh_data = [
+ [-6.902103625349695, -497.1816406250001],
+ [-6.898143347143859, -495.21655273437517],
+ [-6.883664481302669, -488.0980224609375],
+ [-6.880304842490273, -486.46093750000006],
+ [-6.871561546509046, -482.2261962890624],
+ [-6.841973895837549, -468.167236328125],
+ [-6.836376331805493, -465.5539550781251],
+ [-6.833654100575195, -464.2883300781251],
+ [-6.8320816635009045, -463.55883789062483],
+ [-6.8108680173663085, -453.82861328125],
+ [-6.799689165151487, -448.78356933593756],
+ [-6.793579326246197, -446.0499267578126],
+ [-6.762510387544996, -432.4046630859374],
+ [-6.743225720989222, -424.14575195312506],
+ [-6.691758395994307, -402.86828613281244],
+ [-6.690743430063694, -402.4595947265625],
+ [-6.6596501292114505, -390.1383056640624],
+ [-6.652956360641761, -387.5355224609375],
+ [-6.635954365364267, -381.00231933593767],
+ [-6.619587562578274, -374.81726074218744],
+ [-6.617681179427804, -374.10339355468744],
+ [-6.614762741096185, -373.0131835937501],
+ [-6.60690568753706, -370.0938720703124],
+ [-6.591738907156094, -364.5230712890626],
+ [-6.583066984213974, -361.3756103515625],
+ [-6.573999516974134, -358.1136474609374],
+ [-6.553610904389896, -350.8861083984376],
+ [-6.553097634736138, -350.7060546875001],
+ [-6.538320325468202, -345.56164550781267],
+ [-6.529090881007076, -342.386962890625],
+ [-6.527791927233787, -341.94250488281256],
+ [-6.514383886150781, -337.38830566406244],
+ [-6.488639771044976, -328.8133544921875],
+ [-6.480460592697477, -326.13488769531256],
+ [-6.439759999015992, -313.1274414062499],
+ [-6.434927968512049, -311.61804199218744],
+ [-6.4082177348965725, -303.4047851562501],
+ [-6.369671035834965, -291.93200683593756],
+ [-6.362310184909175, -289.79101562500006],
+ [-6.356373428913315, -288.0756835937499],
+ [-6.337756593913614, -282.76220703125006],
+ [-6.32424009706147, -278.96594238281256],
+ [-6.314232650754295, -276.18811035156256],
+ [-6.290994606392703, -269.8439941406249],
+ [-6.240182555852785, -256.4750976562499],
+ [-6.2102675039793604, -248.9161987304687],
+ [-6.197335184435549, -245.71783447265628],
+ [-6.194021350132335, -244.90490722656253],
+ [-6.184119163536406, -242.4917602539062],
+ [-6.104686221071835, -223.97491455078116],
+ [-6.100669325836893, -223.07702636718747],
+ [-6.093582856519022, -221.50177001953122],
+ [-6.0598807500687935, -214.16101074218741],
+ [-6.0062142965262515, -202.97058105468741],
+ [-5.9923121073369945, -200.1683349609375],
+ [-5.981859446096083, -198.08691406249997],
+ [-5.9497792165852905, -191.83300781250006],
+ [-5.90509449745879, -183.44958496093747],
+ [-5.902097012275789, -182.90051269531256],
+ [-5.8144483910067954, -167.55175781250006],
+ [-5.786154254111214, -162.8773803710938],
+ [-5.765917008989405, -159.61425781250006],
+ [-5.703902219845274, -150.0162963867188],
+ [-5.6926689504460395, -148.34051513671872],
+ [-5.685206387751923, -147.23760986328122],
+ [-5.660572815631807, -143.6548461914062],
+ [-5.625516713960633, -138.70599365234375],
+ [-5.476934234171879, -119.55416870117192],
+ [-5.467584665632571, -118.4415588378906],
+ [-5.417932675603434, -112.70410156250004],
+ [-5.406565756574079, -111.43020629882811],
+ [-5.373195678988387, -107.77297973632808],
+ [-5.3723285712183735, -107.67956542968749],
+ [-5.348004040102253, -105.09179687499999],
+ [-5.31087758970896, -101.261474609375],
+ [-5.255348419702703, -95.79150390624997],
+ [-5.206986845736275, -91.26885986328122],
+ [-5.162914035396619, -87.33349609375003],
+ [-5.052952927749896, -78.23873901367186],
+ [-5.048772883924985, -77.91235351562501],
+ [-5.034848487644809, -76.83489990234378],
+ [-4.808269821238499, -61.25564575195312],
+ [-4.689849459883311, -54.413803100585945],
+ [-4.476720236388958, -43.96719360351561],
+ [-4.431216695067421, -42.01084899902342],
+ [-4.114720236218123, -30.60937499999999],
+ [-3.9785790831656023, -26.711166381835938],
+ [-3.9220215830953484, -25.24131774902344],
+ [-3.3770026324620295, -14.624359130859379],
+ [-3.214961448471211, -12.431087493896483],
+ [-3.021397455139021, -10.235607147216797],
+ [-2.937831931335705, -9.41094970703125],
+ [-1.267878515574959, -1.6359391212463381],
+ [1.6504814008555524e-12, 1.6504814008555524e-12],
+ [2.0654207510961697e-12, 2.0654207510961697e-12],
+ [6.933230031758164e-12, 6.933230031758164e-12],
+ [1.3351444949627478e-11, 1.3351444949627478e-11],
+ [1.6399812063916386e-11, 1.6399812063916386e-11],
+ [5.730159402528301e-11, 5.730159402528301e-11],
+ [1.113731329382972e-10, 1.113731329382972e-10],
+ [1.4214707189097453e-10, 1.4214707189097453e-10],
+ [3.8006320313144215e-10, 3.8006320313144215e-10],
+ [6.09162720266454e-10, 6.09162720266454e-10],
+ [1.0221641311147778e-9, 1.0221641311147778e-9],
+ [2.8819222563924995e-9, 2.8819222563924995e-9],
+ [4.7627768395841485e-9, 4.7627768395841485e-9],
+ [8.854133426439148e-9, 8.854133426439148e-9],
+ [2.305032609228874e-8, 2.3050326092288742e-8],
+ [5.939249092534734e-8, 5.9392490925347374e-8],
+ [1.1667648891489053e-7, 1.166764889148908e-7],
+ [2.379967440901942e-7, 2.3799674409019644e-7],
+ [4.6846594159431437e-7, 4.684659415943315e-7],
+ [9.382699772685088e-7, 9.382699772686465e-7],
+ [0.0000011039855962733358, 0.00000110398559627356],
+ [0.000003291776010877096, 0.0000032917760108830407],
+ [0.000007517213816683722, 0.00000751721381675452],
+ [0.000015114666893502755, 0.000015114666894078255],
+ [0.00002986399339999406, 0.00002986399340443313],
+ [0.000033870281179478836, 0.00003387028118595481],
+ [0.00009066011977069884, 0.00009066011989489198],
+ [0.00021949532498377364, 0.00021949532674625516],
+ [0.00043952149320897676, 0.00043952150736004114],
+ [0.0006333151408864353, 0.0006333151832222939],
+ [0.0011151230445582744, 0.001115123275667429],
+ [0.0019624658370807177, 0.001962467096745968],
+ [0.005553725496786973, 0.005553754046559334],
+ [0.008691018931968294, 0.008691128343343735],
+ [0.02992889492062484, 0.02993336319923401],
+ [0.05122020579778827, 0.05124260485172272],
+ [0.1117800293787828, 0.11201295256614685],
+ [0.23269806521543376, 0.23480379581451416],
+ [0.4721357117742938, 0.4898730516433716],
+ [0.694611571189336, 0.7518312931060792],
+ [1.2781607348262256, 1.6557407379150393],
+ [1.9917262343245115, 3.5958566665649414],
+ [2.009484184971722, 3.6627054214477544],
+ [2.128787712416205, 4.142845153808595],
+ [2.4846967934155475, 5.95706558227539],
+ [3.083125584533294, 10.890350341796875],
+ [4.002981567623351, 27.3714599609375],
+ [4.080736210902826, 29.586067199707028],
+ [4.120845430011113, 30.79753875732421],
+ [4.351258506393416, 38.78157043457031],
+ [4.540883728536112, 46.88148498535155],
+ [4.547981853382592, 47.21551513671875],
+ [4.5480891170767, 47.220581054687514],
+ [4.599728302509061, 49.72361755371096],
+ [4.8131842711857535, 61.557464599609396],
+ [4.910082619934558, 67.82162475585939],
+ [4.924747230639767, 68.82363891601564],
+ [4.993937439635391, 73.75466918945312],
+ [5.087099712053554, 80.95669555664065],
+ [5.1389346970196295, 85.26406860351562],
+ [5.138977285472121, 85.26770019531251],
+ [5.223879832616765, 92.82385253906247],
+ [5.241812789460327, 94.50357055664062],
+ [5.447141014648796, 116.04467773437499],
+ [5.511633288238573, 123.77554321289061],
+ [5.578681289305598, 132.3592529296875],
+ [5.633110296634631, 139.76330566406253],
+ [5.662701238627725, 143.96093750000003],
+ [5.678906941005323, 146.31298828124997],
+ [5.737214893086866, 155.0980224609375],
+ [5.739660763047893, 155.4778442382812],
+ [5.741349685869528, 155.74066162109372],
+ [5.790614371552514, 163.60546874999994],
+ [5.879059869096351, 178.73510742187494],
+ [5.884458728291027, 179.70269775390622],
+ [5.885109945587401, 179.8197631835937],
+ [5.893636014368936, 181.35949707031256],
+ [5.965274032538233, 194.82861328125003],
+ [5.967346683696556, 195.23284912109375],
+ [5.986843466070591, 199.07666015624994],
+ [6.019932686217942, 205.77423095703134],
+ [6.021252909681261, 206.0460815429687],
+ [6.037231102920489, 209.36480712890634],
+ [6.043606439928324, 210.70385742187506],
+ [6.06478541011501, 215.21398925781244],
+ [6.112974120371601, 225.83892822265622],
+ [6.117902255760311, 226.95465087890622],
+ [6.1433256889594094, 232.79864501953136],
+ [6.176483527820343, 240.64721679687503],
+ [6.186757751007361, 243.13244628906241],
+ [6.219667373726848, 251.26702880859372],
+ [6.229418088083555, 253.72906494140634],
+ [6.233184983047428, 254.68664550781241],
+ [6.243005711460192, 257.20019531250006],
+ [6.245102704489327, 257.74011230468744],
+ [6.260468857392134, 261.73120117187506],
+ [6.268152459140511, 263.74999999999994],
+ [6.2748285545831655, 265.5167236328125],
+ [6.305976070434008, 273.9171142578125],
+ [6.32399546069982, 278.8977050781249],
+ [6.324961403980197, 279.16723632812506],
+ [6.370613506132747, 292.20727539062494],
+ [6.375359978930309, 293.59753417968744],
+ [6.3766447200146, 293.9749755859376],
+ [6.380802563199264, 295.19982910156244],
+ [6.387824152942429, 297.27990722656244],
+ [6.390003820200831, 297.9285888671876],
+ [6.3905985680679, 298.10583496093744],
+ [6.397866642974941, 300.2803955078125],
+ [6.421725738171608, 307.5310058593751],
+ [6.423818963102848, 308.17541503906244],
+ [6.428865255911759, 309.7344970703124],
+ [6.443449261058927, 314.28479003906244],
+ [6.444844602076255, 314.7236328125],
+ [6.464094341970107, 320.84069824218756],
+ [6.465356699668166, 321.24597167968744],
+ [6.467400466944125, 321.90319824218756],
+ [6.472218114936839, 323.457763671875],
+ [6.4947499213823265, 330.8286132812501],
+ [6.507305446835735, 335.00854492187483],
+ [6.524202033435675, 340.71716308593756],
+ [6.546694993078936, 348.46777343749994],
+ [6.548591493378012, 349.1292724609374],
+ [6.613194950203132, 372.4288330078126],
+ [6.6247505436339065, 376.7574462890626],
+ [6.629181796246806, 378.43066406249994],
+ [6.6616087711302185, 390.9031982421874],
+ [6.698989091751707, 405.79187011718744],
+ [6.702857353572475, 407.3646240234375],
+ [6.717505881986416, 413.37585449218756],
+ [6.723197804327891, 415.73547363281256],
+ [6.726699007993023, 417.1936035156251],
+ [6.735483889307782, 420.87475585937483],
+ [6.755219602793124, 429.26354980468756],
+ [6.756366380816258, 429.75610351562506],
+ [6.766177290841293, 433.99316406250006],
+ [6.766217511883346, 434.01062011718767],
+ [6.780091308338912, 440.0739746093749],
+ [6.802889310303153, 450.22204589843744],
+ [6.813484439494547, 455.017578125],
+ [6.818196843455478, 457.16687011718744],
+ [6.818940201487998, 457.50683593749994],
+ [6.822833193143805, 459.29138183593756],
+ [6.82327083544577, 459.49243164062506],
+ [6.823817951018, 459.743896484375],
+ [6.834945773756887, 464.8884277343749],
+ [6.835113285253827, 464.96630859375017],
+ [6.840964582694129, 467.6949462890624],
+ [6.84346890521034, 468.86767578125017],
+ [6.847141429556457, 470.5927734375002],
+ [6.869243403190376, 481.10961914062483],
+ [6.882355637062964, 487.4595947265624],
+ [6.884531678915821, 488.5214843750001],
+ [6.89341643293734, 492.8812255859376],
+ [6.895822338701104, 494.06848144531233],
+ [6.900653737167637, 496.46130371093733],
+ [7.2670429692740965, 716.1540527343751],
+ [8.188647968122073, 1799.925781250001],
+ [8.872023251113289, 3564.8457031250014],
+ [9.566596912986167, 7139.869140625004],
+ [10.092554861905608, 12081.222656249996],
+ [10.728112113864427, 22810.24218749999],
+ [11.442480870715618, 46598.96875000003],
+ [12.28759157077177, 108493.37500000009],
+ [12.636950838344218, 153860.81249999988],
+ [13.327813723030063, 307019.4999999998],
+ [14.126778167009777, 682577.25],
+ [15.090269265334971, 1788919.000000001],
+ [15.835512291283944, 3769169],
+ [15.973721689554742, 4327820.000000002],
+ [16.910547205715446, 11044023.999999983],
+ [17.573132558903225, 21423208.000000004],
+ [18.649063156437965, 62828288.00000006],
+ [18.760110887365155, 70207360.00000012],
+ [19.547111966180875, 154231424.00000012],
+ [20.193967491567523, 294509055.9999997],
+ [21.484592263156223, 1070557183.9999999],
+ [22.088297141021556, 1957922816.0000024],
+ [22.780591462699917, 3912507392.0000005],
+ [23.401438520318692, 7279233024.000007],
+ [23.684949498080787, 9665245184.000017],
+ [24.5355829820426, 22627590144.000004],
+ [25.520740767599584, 60601991168.00004],
+ [26.31438890085422, 134018236416.00002],
+ [26.73876398039979, 204864946175.99973],
+ [27.06660583008718, 284346286080.00024],
+ [28.234874284944635, 914576637951.9989],
+ [28.78280496108106, 1581915832319.9973]
+];
+
+for (var [x, y] of sinh_data)
+ assertNear(Math.sinh(x), y);
+
+reportCompare(0, 0, "ok");
+
diff --git a/js/src/tests/non262/Math/sinh-exact.js b/js/src/tests/non262/Math/sinh-exact.js
new file mode 100644
index 0000000000..bfae1f7524
--- /dev/null
+++ b/js/src/tests/non262/Math/sinh-exact.js
@@ -0,0 +1,19 @@
+// Properties of Math.sinh that are guaranteed by the spec.
+
+// If x is NaN, the result is NaN.
+assertEq(Math.sinh(NaN), NaN);
+
+// If x is +0, the result is +0.
+assertEq(Math.sinh(+0), +0);
+
+// If x is −0, the result is −0.
+assertEq(Math.sinh(-0), -0);
+
+// If x is +∞, the result is +∞.
+assertEq(Math.sinh(Infinity), Infinity);
+
+// If x is −∞, the result is −∞.
+assertEq(Math.sinh(-Infinity), -Infinity);
+
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/tanh-approx.js b/js/src/tests/non262/Math/tanh-approx.js
new file mode 100644
index 0000000000..252322a099
--- /dev/null
+++ b/js/src/tests/non262/Math/tanh-approx.js
@@ -0,0 +1,282 @@
+var sloppy_tolerance = 2;
+
+for (var i = -20; i < 20; i++) {
+ assertNear(Math.tanh(i),
+ (Math.exp(i) - Math.exp(-i)) / (Math.exp(i) + Math.exp(-i)),
+ sloppy_tolerance);
+}
+
+assertEq(Math.tanh(1e300), 1);
+
+var tanh_data = [
+ [-0.9999983310699463, -6.998237084679027],
+ [-0.9999978542327881, -6.87257975132917],
+ [-0.999992847442627, -6.2705920974657525],
+ [-0.9999861717224121, -5.940967614084813],
+ [-0.9999828338623047, -5.832855225378502],
+ [-0.9999399185180664, -5.20646301208756],
+ [-0.9998834133148193, -4.8749821841810785],
+ [-0.9998509883880615, -4.752279497280338],
+ [-0.9996016025543213, -4.260504202858904],
+ [-0.9993612766265869, -4.0244334353203115],
+ [-0.9989283084869385, -3.7655641082999236],
+ [-0.9969782829284668, -3.246782610980921],
+ [-0.9950058460235596, -2.9950671179940938],
+ [-0.9942638874053955, -2.9256242749609536],
+ [-0.990715742111206, -2.6839646283308363],
+ [-0.9903340339660645, -2.663723350226518],
+ [-0.9760982990264893, -2.207464998348322],
+ [-0.975830078125, -2.201817459680556],
+ [-0.9728245735168457, -2.1424542308291437],
+ [-0.9643559455871582, -2.0046686756020917],
+ [-0.9377224445343018, -1.7188337346177065],
+ [-0.9362406730651855, -1.7066940482565154],
+ [-0.9310147762298584, -1.6659543005533146],
+ [-0.9284839630126953, -1.6472838718760747],
+ [-0.9270248413085938, -1.6368067340881562],
+ [-0.9075665473937988, -1.5135473477311114],
+ [-0.897477388381958, -1.4590986086331497],
+ [-0.8920106887817383, -1.431681573516303],
+ [-0.8776559829711914, -1.365471286049011],
+ [-0.864722728729248, -1.3117705583444539],
+ [-0.8482067584991455, -1.249725893334944],
+ [-0.8056559562683105, -1.1145246028592257],
+ [-0.8048388957977295, -1.112200609756455],
+ [-0.7801985740661621, -1.0458778330822556],
+ [-0.7749934196472168, -1.032711173436253],
+ [-0.7619285583496094, -1.0007967281362184],
+ [-0.7504425048828125, -0.9739672824457072],
+ [-0.7495596408843994, -0.9719492983286864],
+ [-0.7481319904327393, -0.968698942014487],
+ [-0.7459518909454346, -0.9637657636705832],
+ [-0.7401137351989746, -0.9507308314464193],
+ [-0.7289731502532959, -0.9265325319867653],
+ [-0.7226788997650146, -0.9132299082876396],
+ [-0.7161557674407959, -0.8997082193533088],
+ [-0.7017018795013428, -0.8706453720344796],
+ [-0.7013418674468994, -0.86993650130945],
+ [-0.691054105758667, -0.8499705913361888],
+ [-0.6847054958343506, -0.837919455842005],
+ [-0.6838164329528809, -0.8362476144993315],
+ [-0.6747090816497803, -0.8193374156276964],
+ [-0.6575610637664795, -0.7885046044142132],
+ [-0.6522045135498047, -0.7791255597799839],
+ [-0.6261923313140869, -0.7351275788820003],
+ [-0.623173713684082, -0.7301771459970386],
+ [-0.6067488193511963, -0.7037597526130627],
+ [-0.5838055610656738, -0.6682166303197608],
+ [-0.579524040222168, -0.6617457665293066],
+ [-0.5760939121246338, -0.656596458857398],
+ [-0.5654678344726562, -0.6408350116350283],
+ [-0.5578761100769043, -0.6297442839791668],
+ [-0.5523209571838379, -0.6217149641475687],
+ [-0.5396339893341064, -0.6036390747171698],
+ [-0.5128989219665527, -0.5666556256064771],
+ [-0.5087778568267822, -0.5610793900942042],
+ [-0.4977825880050659, -0.546353950571504],
+ [-0.4913865327835083, -0.5378865967606703],
+ [-0.48976075649261475, -0.5357455496477738],
+ [-0.48493504524230957, -0.5294166456244711],
+ [-0.4479050636291504, -0.4820764946679979],
+ [-0.4461095333099365, -0.4798325976916711],
+ [-0.4429593086242676, -0.47590653371561276],
+ [-0.42827916145324707, -0.45778739362936793],
+ [-0.40590059757232666, -0.4306933608076879],
+ [-0.40029656887054443, -0.4240020382545707],
+ [-0.3961341381072998, -0.4190551379319939],
+ [-0.3836275339126587, -0.40430627175908734],
+ [-0.36686253547668457, -0.3847928551425507],
+ [-0.3657644987106323, -0.38352464227459343],
+ [-0.33507001399993896, -0.3485286317501442],
+ [-0.32572221755981445, -0.3380352468276522],
+ [-0.3191967010498047, -0.3307524237890151],
+ [-0.3000025749206543, -0.3095224337886503],
+ [-0.29665136337280273, -0.3058438250228025],
+ [-0.2944457530975342, -0.3034271164344305],
+ [-0.2872810363769531, -0.29560018347246825],
+ [-0.27738428115844727, -0.28484608203169437],
+ [-0.2390844225883484, -0.2438028008332661],
+ [-0.23685944080352783, -0.24144425169391517],
+ [-0.2253856658935547, -0.2293228153248168],
+ [-0.22283810377120972, -0.22664053064745143],
+ [-0.21552443504333496, -0.21895773601143995],
+ [-0.2153375744819641, -0.21876178107952995],
+ [-0.21016258001327515, -0.21334143320771737],
+ [-0.20250272750854492, -0.2053409277979887],
+ [-0.19156384468078613, -0.19396008474133075],
+ [-0.18251943588256836, -0.18458771439322938],
+ [-0.17464947700500488, -0.17645844608618066],
+ [-0.15646183490753174, -0.15775766677189154],
+ [-0.15580910444259644, -0.15708862621964176],
+ [-0.15365445613861084, -0.15488112515549593],
+ [-0.122499018907547, -0.12311733609904851],
+ [-0.1088167130947113, -0.10924929296737837],
+ [-0.08792558312416077, -0.08815322150790302],
+ [-0.08401328325271606, -0.08421178632314608],
+ [-0.06121261417865753, -0.06128924075509796],
+ [-0.05341699719429016, -0.05346789060550386],
+ [-0.05047759413719177, -0.05052053189238029],
+ [-0.02924579381942749, -0.029254136237332657],
+ [-0.02485968917608261, -0.02486481220617492],
+ [-0.020469173789024353, -0.02047203328100153],
+ [-0.01882001757621765, -0.018822240021756347],
+ [-0.016152501106262207, -0.016153906073109205],
+ [-0.0032715508714318275, -0.003271562543358962],
+ [1.6504814008555524e-12, 1.6504814008555524e-12],
+ [2.0654207510961697e-12, 2.0654207510961697e-12],
+ [6.933230031758164e-12, 6.933230031758164e-12],
+ [1.3351444949627478e-11, 1.3351444949627478e-11],
+ [1.6399812063916386e-11, 1.6399812063916386e-11],
+ [5.730159402528301e-11, 5.730159402528301e-11],
+ [1.113731329382972e-10, 1.113731329382972e-10],
+ [1.4214707189097453e-10, 1.4214707189097453e-10],
+ [3.8006320313144215e-10, 3.8006320313144215e-10],
+ [6.09162720266454e-10, 6.09162720266454e-10],
+ [1.0221641311147778e-9, 1.0221641311147778e-9],
+ [2.8819222563924995e-9, 2.8819222563924995e-9],
+ [4.7627768395841485e-9, 4.7627768395841485e-9],
+ [8.854133426439148e-9, 8.854133426439148e-9],
+ [2.3050326092288742e-8, 2.3050326092288745e-8],
+ [5.9392490925347374e-8, 5.939249092534745e-8],
+ [1.166764889148908e-7, 1.1667648891489133e-7],
+ [2.3799674409019644e-7, 2.3799674409020094e-7],
+ [4.684659415943315e-7, 4.684659415943658e-7],
+ [9.382699772686465e-7, 9.382699772689218e-7],
+ [0.00000110398559627356, 0.0000011039855962740086],
+ [0.0000032917760108830407, 0.0000032917760108949305],
+ [0.00000751721381675452, 0.000007517213816896115],
+ [0.000015114666894078255, 0.000015114666895229252],
+ [0.00002986399340443313, 0.00002986399341331128],
+ [0.00003387028118595481, 0.000033870281198906756],
+ [0.00009066011989489198, 0.00009066012014327826],
+ [0.00021949532674625516, 0.0002194953302712184],
+ [0.00043952150736004114, 0.0004395215356621756],
+ [0.0006333151832222939, 0.0006333152678940465],
+ [0.001115123275667429, 0.0011151237378863419],
+ [0.001962467096745968, 0.001962469616086656],
+ [0.005553754046559334, 0.005553811147953338],
+ [0.007324676960706711, 0.0073248079567425],
+ [0.008691128343343735, 0.008691347183450786],
+ [0.011912941932678223, 0.011913505535037906],
+ [0.02993336319923401, 0.029942308168570204],
+ [0.05124260485172272, 0.05128752666822782],
+ [0.05473744869232178, 0.05479221508125444],
+ [0.06158891320228577, 0.061666963819518306],
+ [0.09375360608100891, 0.09402975380882211],
+ [0.09442159533500671, 0.09470370926367391],
+ [0.09443172812461853, 0.09471393321406026],
+ [0.09943729639053345, 0.09976699249016487],
+ [0.11201295256614685, 0.11248498303558895],
+ [0.12310260534286499, 0.12373016402339168],
+ [0.13562965393066406, 0.13647060950861248],
+ [0.13763350248336792, 0.13851257866094746],
+ [0.14749455451965332, 0.14857829980464834],
+ [0.1618971824645996, 0.16333433166790448],
+ [0.17051106691360474, 0.17219298693637355],
+ [0.17051833868026733, 0.17220047646299907],
+ [0.18562912940979004, 0.18780647318150087],
+ [0.18898820877075195, 0.1912876932893582],
+ [0.23206615447998047, 0.23637212433914523],
+ [0.23480379581451416, 0.2392675448267427],
+ [0.2646920680999756, 0.27114729033023005],
+ [0.2794986963272095, 0.2871382059344433],
+ [0.28789305686950684, 0.2962673858386819],
+ [0.292596697807312, 0.30140373665239234],
+ [0.3101649284362793, 0.320727882769785],
+ [0.3109246492385864, 0.3215686893944558],
+ [0.31145012378692627, 0.3221505056451929],
+ [0.3271782398223877, 0.3396649461699478],
+ [0.3574345111846924, 0.37394153436545424],
+ [0.3593693971633911, 0.37616159223090223],
+ [0.35960352420806885, 0.37643046596933716],
+ [0.3626827001571655, 0.3799714809649667],
+ [0.38961827754974365, 0.4113499159905353],
+ [0.3904266357421875, 0.41230330080214],
+ [0.3981136083602905, 0.4214052375603139],
+ [0.411507248878479, 0.43742438709579096],
+ [0.4120509624481201, 0.43807911823743495],
+ [0.41868770122528076, 0.4460997186945703],
+ [0.42136549949645996, 0.4493511447897729],
+ [0.4516327381134033, 0.48674948990473677],
+ [0.4538639783859253, 0.4895560176112375],
+ [0.4655507802963257, 0.5043748446613433],
+ [0.48124635219573975, 0.5246050193978663],
+ [0.48621630668640137, 0.5310932154891663],
+ [0.4898730516433716, 0.5358932909903701],
+ [0.5024838447570801, 0.5526234425942533],
+ [0.5074074268341064, 0.5592320547729962],
+ [0.5093221664428711, 0.5618140818296767],
+ [0.5143489837646484, 0.5686253097655146],
+ [0.5154285430908203, 0.5700943191671631],
+ [0.5234100818634033, 0.5810250825991418],
+ [0.5274472236633301, 0.5866018515043636],
+ [0.5309803485870361, 0.5915094458340507],
+ [0.5477793216705322, 0.6152030999229688],
+ [0.5577394962310791, 0.6295459624918965],
+ [0.5582785606384277, 0.6303287742357745],
+ [0.5843560695648193, 0.6690521906099505],
+ [0.5871362686157227, 0.6732844960442398],
+ [0.5878911018371582, 0.6744372167164567],
+ [0.5903406143188477, 0.6781887236623534],
+ [0.5945003032684326, 0.684597775489552],
+ [0.5957975387573242, 0.6866065102131665],
+ [0.5961520671844482, 0.6871563252400655],
+ [0.6005008220672607, 0.6939300827887145],
+ [0.6150004863739014, 0.7169242329194352],
+ [0.6162893772125244, 0.7189998055497108],
+ [0.6194069385528564, 0.7240422748778544],
+ [0.6285066604614258, 0.7389438896054792],
+ [0.6293842792510986, 0.7403958734869583],
+ [0.6416172981262207, 0.7609178886018204],
+ [0.6424276828765869, 0.7622965466812235],
+ [0.6437420845031738, 0.7645378650643101],
+ [0.6468508243560791, 0.769864795178161],
+ [0.6615910530090332, 0.7956379107512945],
+ [0.669950008392334, 0.8106524185805045],
+ [0.6813662052154541, 0.8316597473423232],
+ [0.6968657970428467, 0.8611812790659296],
+ [0.6981887817382812, 0.8637579113749143],
+ [0.7447831630706787, 0.9611360201710216],
+ [0.7518312931060791, 0.9771540941752986],
+ [0.7534394264221191, 0.9808634133542229],
+ [0.7567856311798096, 0.9886489208209699],
+ [0.7817282676696777, 1.0497991719828956],
+ [0.8115026950836182, 1.1314141444187586],
+ [0.814647912979126, 1.1406947755584418],
+ [0.8266689777374268, 1.1775230833699681],
+ [0.8313877582550049, 1.1926138225701433],
+ [0.8343038558959961, 1.2021323323039612],
+ [0.8416652679443359, 1.2268570644335162],
+ [0.8584413528442383, 1.2873896671573652],
+ [0.8678996562957764, 1.3245040433929398],
+ [0.8679344654083252, 1.3246451309261607],
+ [0.8800599575042725, 1.3760334877782177],
+ [0.9003539085388184, 1.4740852961194106],
+ [0.9099440574645996, 1.5271990851861994],
+ [0.9142425060272217, 1.5527768948273004],
+ [0.9149219989776611, 1.556931837197936],
+ [0.9184908866882324, 1.5792896628381612],
+ [0.9188928604125977, 1.5818663359427627],
+ [0.919395923614502, 1.5851082843320008],
+ [0.9296839237213135, 1.6560555223295368],
+ [0.9298396110534668, 1.6572041418041492],
+ [0.9352962970733643, 1.6990986433619266],
+ [0.9376416206359863, 1.718164398807965],
+ [0.9410912990570068, 1.7475084077246632],
+ [0.962122917175293, 1.9737180163455101],
+ [0.9748215675354004, 2.1811227771083783],
+ [0.9769454002380371, 2.2257214499698255],
+ [0.985663890838623, 2.4654635601650536],
+ [0.9880380630493164, 2.5565869228142004],
+ [0.9928233623504639, 2.8132383539094192],
+ [1e-300, 1e-300],
+ [0.00001, 0.000010000000000333334],
+ [0.3, 0.3095196042031117],
+ [1e-30, 1e-30],
+ [1e-10, 1e-10],
+];
+
+for (var [x, y] of tanh_data)
+ assertNear(Math.tanh(y), x, sloppy_tolerance);
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/tanh-exact.js b/js/src/tests/non262/Math/tanh-exact.js
new file mode 100644
index 0000000000..bfd9ac4def
--- /dev/null
+++ b/js/src/tests/non262/Math/tanh-exact.js
@@ -0,0 +1,19 @@
+// Properties of Math.tanh that are guaranteed by the spec.
+
+// If x is NaN, the result is NaN.
+assertEq(Math.tanh(NaN), NaN);
+
+// If x is +0, the result is +0.
+assertEq(Math.tanh(+0), +0);
+
+// If x is −0, the result is −0.
+assertEq(Math.tanh(-0), -0);
+
+// If x is +∞, the result is +1.
+assertEq(Math.tanh(Number.POSITIVE_INFINITY), +1);
+
+// If x is −∞, the result is -1.
+assertEq(Math.tanh(Number.NEGATIVE_INFINITY), -1);
+
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/Math/trunc.js b/js/src/tests/non262/Math/trunc.js
new file mode 100644
index 0000000000..4cadfd9224
--- /dev/null
+++ b/js/src/tests/non262/Math/trunc.js
@@ -0,0 +1,50 @@
+// If x is NaN, the result is NaN.
+assertEq(Math.trunc(NaN), NaN);
+
+// If x is −0, the result is −0.
+assertEq(Math.trunc(-0), -0);
+
+// If x is +0, the result is +0.
+assertEq(Math.trunc(+0), +0);
+
+// If x is +∞, the result is +∞.
+assertEq(Math.trunc(Infinity), Infinity);
+
+// If x is −∞, the result is −∞.
+assertEq(Math.trunc(-Infinity), -Infinity);
+
+// Other boundary cases.
+var MAX_NONINTEGER_VALUE = 4503599627370495.5;
+var TRUNC_MAX_NONINTEGER_VALUE = 4503599627370495;
+
+assertEq(Math.trunc(Number.MIN_VALUE), +0);
+assertEq(Math.trunc(ONE_MINUS_EPSILON), +0);
+assertEq(Math.trunc(ONE_PLUS_EPSILON), 1);
+assertEq(Math.trunc(MAX_NONINTEGER_VALUE), TRUNC_MAX_NONINTEGER_VALUE);
+assertEq(Math.trunc(Number.MAX_VALUE), Number.MAX_VALUE);
+
+assertEq(Math.trunc(-Number.MIN_VALUE), -0);
+assertEq(Math.trunc(-ONE_MINUS_EPSILON), -0);
+assertEq(Math.trunc(-ONE_PLUS_EPSILON), -1);
+assertEq(Math.trunc(-MAX_NONINTEGER_VALUE), -TRUNC_MAX_NONINTEGER_VALUE);
+assertEq(Math.trunc(-Number.MAX_VALUE), -Number.MAX_VALUE);
+
+// Other cases.
+for (var i = 1, f = 1.1; i < 20; i++, f += 1.0)
+ assertEq(Math.trunc(f), i);
+
+for (var i = -1, f = -1.1; i > -20; i--, f -= 1.0)
+ assertEq(Math.trunc(f), i);
+
+assertEq(Math.trunc(1e40 + 0.5), 1e40);
+
+assertEq(Math.trunc(1e300), 1e300);
+assertEq(Math.trunc(-1e300), -1e300);
+assertEq(Math.trunc(1e-300), 0);
+assertEq(Math.trunc(-1e-300), -0);
+
+assertEq(Math.trunc(+0.9999), +0);
+assertEq(Math.trunc(-0.9999), -0);
+
+
+reportCompare(0, 0, "ok");