зеркало из https://github.com/mozilla/gecko-dev.git
Bug 933257 - Part 7: Remove or reduce sloppy_tolerance in Math function tests. r=jorendorff
This commit is contained in:
Родитель
ed83ebe4b8
Коммит
48f2d46a6a
|
@ -262,7 +262,7 @@ var cosh_data = [
|
|||
[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);
|
||||
|
|
|
@ -282,24 +282,22 @@ var sinh_data = [
|
|||
[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");
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ var tanh_data = [
|
|||
[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);
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
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 ],
|
||||
|
@ -14,6 +12,6 @@ var cbrt_data = [
|
|||
];
|
||||
|
||||
for (var [x, y] of cbrt_data)
|
||||
assertNear(Math.cbrt(x), y, sloppy_tolerance);
|
||||
assertNear(Math.cbrt(x), y);
|
||||
|
||||
reportCompare(0, 0, "ok");
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
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],
|
||||
|
@ -270,9 +268,9 @@ var cosh_data = [
|
|||
];
|
||||
|
||||
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");
|
||||
|
|
|
@ -2,13 +2,8 @@ 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');
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
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],
|
||||
|
@ -292,7 +291,7 @@ var sinh_data = [
|
|||
];
|
||||
|
||||
for (var [x, y] of sinh_data)
|
||||
assertNear(Math.sinh(x), y, sloppy_tolerance);
|
||||
assertNear(Math.sinh(x), y);
|
||||
|
||||
reportCompare(0, 0, "ok");
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var sloppy_tolerance = 4;
|
||||
var sloppy_tolerance = 2;
|
||||
|
||||
for (var i = -20; i < 20; i++) {
|
||||
assertNear(Math.tanh(i),
|
||||
|
|
Загрузка…
Ссылка в новой задаче