Bug 933257 - Part 7: Remove or reduce sloppy_tolerance in Math function tests. r=jorendorff
authorTooru Fujisawa <arai_a@mac.com>
Thu, 07 Jan 2016 14:21:26 +0900
changeset 291805 18ec8a268573f55f9883c4e01398d65eb8c136d1
parent 291804 b053ad6763d638384a7ae0f4d5c1238277afcea5
child 291806 cf14555864566e4ee197ac7074ec61a5e03e4e90
push id74680
push userarai_a@mac.com
push dateWed, 06 Apr 2016 00:00:56 +0000
treeherdermozilla-inbound@336759fb7df0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs933257
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 933257 - Part 7: Remove or reduce sloppy_tolerance in Math function tests. r=jorendorff
js/src/tests/ecma_6/Math/acosh-approx.js
js/src/tests/ecma_6/Math/asinh-approx.js
js/src/tests/ecma_6/Math/atanh-approx.js
js/src/tests/ecma_6/Math/cbrt-approx.js
js/src/tests/ecma_6/Math/cosh-approx.js
js/src/tests/ecma_6/Math/log10-approx.js
js/src/tests/ecma_6/Math/sinh-approx.js
js/src/tests/ecma_6/Math/tanh-approx.js
--- a/js/src/tests/ecma_6/Math/acosh-approx.js
+++ b/js/src/tests/ecma_6/Math/acosh-approx.js
@@ -257,17 +257,17 @@ var cosh_data = [
     [48862560256, 25.305424481799395],
     [113763549184, 26.150535181949436],
     [161334755328, 26.499894449532565],
     [321933279232, 27.19075733422632],
     [715734122496, 27.989721778208146],
     [1875817529344, 28.953212876533797]
 ];
 
-var sloppy_tolerance = 1000;  // FIXME
+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++) {
--- a/js/src/tests/ecma_6/Math/asinh-approx.js
+++ b/js/src/tests/ecma_6/Math/asinh-approx.js
@@ -277,29 +277,27 @@ var sinh_data = [
     [60601991168, 25.520740767599584],
     [134018236416, 26.31438890085422],
     [204864946176, 26.73876398039979],
     [284346286080, 27.06660583008718],
     [914576637952, 28.234874284944635],
     [1581915832320, 28.78280496108106]
 ];
 
-var sloppy_tolerance = 1000;  // FIXME
-
 for (var [x, y] of sinh_data)
-    assertNear(Math.asinh(x), y, sloppy_tolerance);
+    assertNear(Math.asinh(x), y);
 
-assertNear(Math.asinh(1e300), 691.4686750787737, sloppy_tolerance);
-assertNear(Math.asinh(1e-300), 1e-300, sloppy_tolerance);
-assertNear(Math.asinh(1e-5), 0.000009999999999833334, sloppy_tolerance);
-assertNear(Math.asinh(0.3), 0.29567304756342244, sloppy_tolerance);
-assertNear(Math.asinh(1), 0.881373587019543, sloppy_tolerance);
+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, sloppy_tolerance);
+    assertNear(Math.asinh(Math.sinh(x)), x);
 }
 
 for (var i = -20; i < 20; i++)
-    assertNear(Math.asinh(Math.sinh(i)), i, sloppy_tolerance);
+    assertNear(Math.asinh(Math.sinh(i)), i);
 
 reportCompare(0, 0, "ok");
 
--- a/js/src/tests/ecma_6/Math/atanh-approx.js
+++ b/js/src/tests/ecma_6/Math/atanh-approx.js
@@ -261,17 +261,17 @@ var tanh_data = [
     [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 = 10;  // FIXME
+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)
--- a/js/src/tests/ecma_6/Math/cbrt-approx.js
+++ b/js/src/tests/ecma_6/Math/cbrt-approx.js
@@ -1,19 +1,17 @@
 assertEq(Math.cbrt(1), 1);
 assertEq(Math.cbrt(-1), -1);
 
-var sloppy_tolerance = 200;  // FIXME
-
-assertNear(Math.cbrt(1e-300), 1e-100, sloppy_tolerance);
-assertNear(Math.cbrt(-1e-300), -1e-100, sloppy_tolerance);
+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, sloppy_tolerance);
+    assertNear(Math.cbrt(x), y);
 
 reportCompare(0, 0, "ok");
--- a/js/src/tests/ecma_6/Math/cosh-approx.js
+++ b/js/src/tests/ecma_6/Math/cosh-approx.js
@@ -1,14 +1,12 @@
-var sloppy_tolerance = 100;
-
 assertEq(Math.cosh(1000), Infinity);
 assertEq(Math.cosh(Number.MAX_VALUE), Infinity);
-assertNear(Math.cosh(1e-30), 1, sloppy_tolerance);
-assertNear(Math.cosh(1e-10), 1, sloppy_tolerance);
+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],
@@ -265,14 +263,14 @@ var cosh_data = [
     [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, sloppy_tolerance);
+    assertNear(Math.cosh(x), y);
 
 for (var i = -20; i < 20; i++)
-    assertNear(Math.cosh(i), (Math.exp(i) + Math.exp(-i)) / 2, sloppy_tolerance);
+    assertNear(Math.cosh(i), (Math.exp(i) + Math.exp(-i)) / 2);
 
 reportCompare(0, 0, "ok");
--- a/js/src/tests/ecma_6/Math/log10-approx.js
+++ b/js/src/tests/ecma_6/Math/log10-approx.js
@@ -1,14 +1,9 @@
 assertNear(Math.log10(2), 0.3010299956639812);
 assertNear(Math.log10(7), 0.8450980400142568);
 assertNear(Math.log10(Math.E), Math.LOG10E);
 
-// FIXME
-// On Mac OS X 10.7 32bit build, Math.log10(0.01) returns bfffffff fffffffe.
-// See bug 1225024.
-var sloppy_tolerance = 2;
-
 for (var i = -10; i < 10; i++)
-    assertNear(Math.log10(Math.pow(10, i)), i, sloppy_tolerance);
+    assertNear(Math.log10(Math.pow(10, i)), i);
 
 reportCompare(0, 0, 'ok');
 
--- a/js/src/tests/ecma_6/Math/sinh-approx.js
+++ b/js/src/tests/ecma_6/Math/sinh-approx.js
@@ -1,16 +1,15 @@
-var sloppy_tolerance = 100;
 for (var i = -20; i < 20; i++)
-    assertNear(Math.sinh(i), (Math.exp(i) - Math.exp(-i)) / 2, sloppy_tolerance);
+    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, sloppy_tolerance);
-assertNear(Math.sinh(1e-10), 1e-10, sloppy_tolerance);
+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],
@@ -287,12 +286,12 @@ var sinh_data = [
     [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, sloppy_tolerance);
+    assertNear(Math.sinh(x), y);
 
 reportCompare(0, 0, "ok");
 
--- a/js/src/tests/ecma_6/Math/tanh-approx.js
+++ b/js/src/tests/ecma_6/Math/tanh-approx.js
@@ -1,9 +1,9 @@
-var sloppy_tolerance = 4;
+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);