From 4ebdecd8718759eb46716400304917ec1c67594b Mon Sep 17 00:00:00 2001 From: Denis Pushkarev Date: Sun, 4 Oct 2015 21:56:35 +0600 Subject: [PATCH] [tests] extract `assert.epsilon` helper --- tests/es.js | 126 ++++++++++++-------------------- tests/helpers.js | 7 ++ tests/helpers/epsilon.ls | 2 + tests/library.js | 126 ++++++++++++-------------------- tests/library/es6.math.acosh.ls | 11 ++- tests/library/es6.math.asinh.ls | 11 ++- tests/library/es6.math.atanh.ls | 7 +- tests/library/es6.math.cbrt.ls | 5 +- tests/library/es6.math.cosh.ls | 9 +-- tests/library/es6.math.expm1.ls | 5 +- tests/library/es6.math.hypot.ls | 5 +- tests/library/es6.math.log10.ls | 11 ++- tests/library/es6.math.log1p.ls | 5 +- tests/library/es6.math.log2.ls | 3 +- tests/library/es6.math.sinh.ls | 5 +- tests/library/es6.math.tanh.ls | 3 +- tests/tests.js | 126 ++++++++++++-------------------- tests/tests/es6.math.acosh.ls | 11 ++- tests/tests/es6.math.asinh.ls | 11 ++- tests/tests/es6.math.atanh.ls | 7 +- tests/tests/es6.math.cbrt.ls | 5 +- tests/tests/es6.math.cosh.ls | 9 +-- tests/tests/es6.math.expm1.ls | 5 +- tests/tests/es6.math.hypot.ls | 5 +- tests/tests/es6.math.log10.ls | 11 ++- tests/tests/es6.math.log1p.ls | 5 +- tests/tests/es6.math.log2.ls | 3 +- tests/tests/es6.math.sinh.ls | 5 +- tests/tests/es6.math.tanh.ls | 3 +- 29 files changed, 212 insertions(+), 335 deletions(-) create mode 100644 tests/helpers/epsilon.ls diff --git a/tests/es.js b/tests/es.js index 60e6797f98f0..6b7e06001499 100644 --- a/tests/es.js +++ b/tests/es.js @@ -1270,10 +1270,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.acosh', function(assert){ - var epsilon, acosh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var acosh; acosh = Math.acosh; assert.ok(toString$.call(acosh).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(acosh.name, 'acosh', 'name is "acosh"'); @@ -1285,11 +1282,11 @@ assert.same(acosh(-1e300), NaN); assert.same(acosh(1), 0); assert.strictEqual(acosh(Infinity), Infinity); - assert.ok(epsilon(acosh(1234), 7.811163220849231)); - assert.ok(epsilon(acosh(8.88), 2.8737631531629235)); - assert.ok(epsilon(acosh(1e+160), 369.10676205960726)); - assert.ok(epsilon(acosh(Number.MAX_VALUE), 710.475860073944)); - return assert.ok(epsilon(acosh(1 + Number.EPSILON), 2.1073424255447017e-8)); + assert.epsilon(acosh(1234), 7.811163220849231); + assert.epsilon(acosh(8.88), 2.8737631531629235); + assert.epsilon(acosh(1e+160), 369.10676205960726); + assert.epsilon(acosh(Number.MAX_VALUE), 710.475860073944); + return assert.epsilon(acosh(1 + Number.EPSILON), 2.1073424255447017e-8); }); }).call(this); @@ -1299,10 +1296,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.asinh', function(assert){ - var epsilon, asinh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var asinh; asinh = Math.asinh; assert.ok(toString$.call(asinh).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(asinh.name, 'asinh', 'name is "asinh"'); @@ -1313,11 +1307,11 @@ assert.same(asinh(-0), -0); assert.strictEqual(asinh(Infinity), Infinity); assert.strictEqual(asinh(-Infinity), -Infinity); - assert.ok(epsilon(asinh(1234), 7.811163549201245)); - assert.ok(epsilon(asinh(9.99), 2.997227420191335)); - assert.ok(epsilon(asinh(1e150), 346.0809111296668)); - assert.ok(epsilon(asinh(1e7), 16.811242831518268)); - return assert.ok(epsilon(asinh(-1e7), -16.811242831518268)); + assert.epsilon(asinh(1234), 7.811163549201245); + assert.epsilon(asinh(9.99), 2.997227420191335); + assert.epsilon(asinh(1e150), 346.0809111296668); + assert.epsilon(asinh(1e7), 16.811242831518268); + return assert.epsilon(asinh(-1e7), -16.811242831518268); }); }).call(this); @@ -1327,10 +1321,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.atanh', function(assert){ - var epsilon, atanh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var atanh; atanh = Math.atanh; assert.ok(toString$.call(atanh).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(atanh.name, 'atanh', 'name is "atanh"'); @@ -1347,9 +1338,9 @@ assert.same(atanh(-0), -0); assert.same(atanh(-1e300), NaN); assert.same(atanh(1e300), NaN); - assert.ok(epsilon(atanh(0.5), 0.5493061443340549)); - assert.ok(epsilon(atanh(-0.5), -0.5493061443340549)); - return assert.ok(epsilon(atanh(0.444), 0.47720201260109457)); + assert.epsilon(atanh(0.5), 0.5493061443340549); + assert.epsilon(atanh(-0.5), -0.5493061443340549); + return assert.epsilon(atanh(0.444), 0.47720201260109457); }); }).call(this); @@ -1359,10 +1350,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.cbrt', function(assert){ - var epsilon, cbrt; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var cbrt; cbrt = Math.cbrt; assert.ok(toString$.call(cbrt).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(cbrt.name, 'cbrt', 'name is "cbrt"'); @@ -1375,8 +1363,8 @@ assert.strictEqual(cbrt(-Infinity), -Infinity); assert.strictEqual(cbrt(-8), -2); assert.strictEqual(cbrt(8), 2); - assert.ok(epsilon(cbrt(-1000), -10)); - return assert.ok(epsilon(cbrt(1000), 10)); + assert.epsilon(cbrt(-1000), -10); + return assert.epsilon(cbrt(1000), 10); }); }).call(this); @@ -1407,10 +1395,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.cosh', function(assert){ - var epsilon, cosh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var cosh; cosh = Math.cosh; assert.ok(toString$.call(cosh).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(cosh.name, 'cosh', 'name is "cosh"'); @@ -1421,10 +1406,10 @@ assert.strictEqual(cosh(-0), 1); assert.strictEqual(cosh(Infinity), Infinity); assert.strictEqual(cosh(-Infinity), Infinity); - assert.ok(epsilon(cosh(12), 81377.39571257407, 3e-11)); - assert.ok(epsilon(cosh(22), 1792456423.065795780980053377, 1e-5)); - assert.ok(epsilon(cosh(-10), 11013.23292010332313972137)); - return assert.ok(epsilon(cosh(-23), 4872401723.1244513000, 1e-5)); + assert.epsilon(cosh(12), 81377.39571257407, 3e-11); + assert.epsilon(cosh(22), 1792456423.065795780980053377, 1e-5); + assert.epsilon(cosh(-10), 11013.23292010332313972137); + return assert.epsilon(cosh(-23), 4872401723.1244513000, 1e-5); }); }).call(this); @@ -1434,10 +1419,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.expm1', function(assert){ - var epsilon, expm1; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var expm1; expm1 = Math.expm1; assert.ok(toString$.call(expm1).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(expm1.name, 'expm1', 'name is "expm1"'); @@ -1448,7 +1430,7 @@ assert.same(expm1(-0), -0); assert.strictEqual(expm1(Infinity), Infinity); assert.strictEqual(expm1(-Infinity), -1); - return assert.ok(epsilon(expm1(10), 22025.465794806718, assert.ok(epsilon(expm1(-10), -0.9999546000702375)))); + return assert.epsilon(expm1(10), 22025.465794806718, assert.epsilon(expm1(-10), -0.9999546000702375)); }); }).call(this); @@ -1497,10 +1479,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.hypot', function(assert){ - var epsilon, hypot, sqrt; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var hypot, sqrt; hypot = Math.hypot, sqrt = Math.sqrt; assert.ok(toString$.call(hypot).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(hypot.name, 'hypot', 'name is "hypot"'); @@ -1534,8 +1513,8 @@ assert.strictEqual(hypot(1, 0, 0), 1); assert.strictEqual(hypot(2, 3, 4), sqrt(2 * 2 + 3 * 3 + 4 * 4)); assert.strictEqual(hypot(2, 3, 4, 5), sqrt(2 * 2 + 3 * 3 + 4 * 4 + 5 * 5)); - assert.ok(epsilon(hypot(66, 66), 93.33809511662427)); - assert.ok(epsilon(hypot(0.1, 100), 100.0000499999875)); + assert.epsilon(hypot(66, 66), 93.33809511662427); + assert.epsilon(hypot(0.1, 100), 100.0000499999875); assert.strictEqual(hypot(1e+300, 1e+300), 1.4142135623730952e+300); assert.strictEqual(Math.floor(hypot(1e-300, 1e-300) * 1e308), 141421356); assert.strictEqual(hypot(1e+300, 1e+300, 2, 3), 1.4142135623730952e+300); @@ -1600,10 +1579,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.log10', function(assert){ - var epsilon, log10; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var log10; log10 = Math.log10; assert.ok(toString$.call(log10).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(log10.name, 'log10', 'name is "log10"'); @@ -1616,11 +1592,11 @@ assert.same(log10(-0), -Infinity); assert.same(log10(1), 0); assert.same(log10(Infinity), Infinity); - assert.ok(epsilon(log10(0.1), -1)); - assert.ok(epsilon(log10(0.5), -0.3010299956639812)); - assert.ok(epsilon(log10(1.5), 0.17609125905568124)); - assert.ok(epsilon(log10(5), 0.6989700043360189)); - return assert.ok(epsilon(log10(50), 1.6989700043360187)); + assert.epsilon(log10(0.1), -1); + assert.epsilon(log10(0.5), -0.3010299956639812); + assert.epsilon(log10(1.5), 0.17609125905568124); + assert.epsilon(log10(5), 0.6989700043360189); + return assert.epsilon(log10(50), 1.6989700043360187); }); }).call(this); @@ -1630,10 +1606,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.log1p', function(assert){ - var epsilon, log1p; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var log1p; log1p = Math.log1p; assert.ok(toString$.call(log1p).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(log1p.name, 'log1p', 'name is "log1p"'); @@ -1646,8 +1619,8 @@ assert.same(log1p(0), 0); assert.same(log1p(-0), -0); assert.same(log1p(Infinity), Infinity); - assert.ok(epsilon(log1p(5), 1.791759469228055)); - return assert.ok(epsilon(log1p(50), 3.9318256327243257)); + assert.epsilon(log1p(5), 1.791759469228055); + return assert.epsilon(log1p(50), 3.9318256327243257); }); }).call(this); @@ -1657,10 +1630,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.log2', function(assert){ - var epsilon, log2; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var log2; log2 = Math.log2; assert.ok(toString$.call(log2).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(log2.name, 'log2', 'name is "log2"'); @@ -1675,7 +1645,7 @@ assert.same(log2(Infinity), Infinity); assert.same(log2(0.5), -1); assert.same(log2(32), 5); - return assert.ok(epsilon(log2(5), 2.321928094887362)); + return assert.epsilon(log2(5), 2.321928094887362); }); }).call(this); @@ -1710,10 +1680,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.sinh', function(assert){ - var epsilon, sinh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var sinh; sinh = Math.sinh; assert.ok(toString$.call(sinh).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(sinh.name, 'sinh', 'name is "sinh"'); @@ -1724,8 +1691,8 @@ assert.same(sinh(-0), -0); assert.strictEqual(sinh(Infinity), Infinity); assert.strictEqual(sinh(-Infinity), -Infinity); - assert.ok(epsilon(sinh(-5), -74.20321057778875)); - assert.ok(epsilon(sinh(2), 3.6268604078470186)); + assert.epsilon(sinh(-5), -74.20321057778875); + assert.epsilon(sinh(2), 3.6268604078470186); return assert.strictEqual(sinh(-2e-17), -2e-17); }); }).call(this); @@ -1736,10 +1703,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.tanh', function(assert){ - var epsilon, tanh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var tanh; tanh = Math.tanh; assert.ok(toString$.call(tanh).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(tanh.name, 'tanh', 'name is "tanh"'); @@ -1750,7 +1714,7 @@ assert.same(tanh(-0), -0); assert.strictEqual(tanh(Infinity), 1); assert.strictEqual(tanh(90), 1); - return assert.ok(epsilon(tanh(10), 0.9999999958776927)); + return assert.epsilon(tanh(10), 0.9999999958776927); }); }).call(this); diff --git a/tests/helpers.js b/tests/helpers.js index 980b078f6e45..65b92f70a8e5 100644 --- a/tests/helpers.js +++ b/tests/helpers.js @@ -1,3 +1,10 @@ +// Generated by LiveScript 1.3.1 +(function(){ + QUnit.assert.epsilon = function(a, b, E, message){ + this.push(Math.abs(a - b) <= (E != null ? E : 1e-11), a, b, message); + }; +}).call(this); + // Generated by LiveScript 1.3.1 (function(){ QUnit.assert.same = function(a, b, message){ diff --git a/tests/helpers/epsilon.ls b/tests/helpers/epsilon.ls new file mode 100644 index 000000000000..1478ba1636a7 --- /dev/null +++ b/tests/helpers/epsilon.ls @@ -0,0 +1,2 @@ +QUnit.assert.epsilon = !(a, b, E, message)-> + @push (Math.abs(a - b) <= if E? => E else 1e-11), a, b, message \ No newline at end of file diff --git a/tests/library.js b/tests/library.js index 3486910e9612..ceaf3c289190 100644 --- a/tests/library.js +++ b/tests/library.js @@ -2089,10 +2089,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.acosh', function(assert){ - var epsilon, acosh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var acosh; acosh = core.Math.acosh; assert.ok(toString$.call(acosh).slice(8, -1) === 'Function', 'is function'); assert.same(acosh(NaN), NaN); @@ -2101,11 +2098,11 @@ assert.same(acosh(-1e300), NaN); assert.same(acosh(1), 0); assert.strictEqual(acosh(Infinity), Infinity); - assert.ok(epsilon(acosh(1234), 7.811163220849231)); - assert.ok(epsilon(acosh(8.88), 2.8737631531629235)); - assert.ok(epsilon(acosh(1e+160), 369.10676205960726)); - assert.ok(epsilon(acosh(Number.MAX_VALUE), 710.475860073944)); - return assert.ok(epsilon(acosh(1 + core.Number.EPSILON), 2.1073424255447017e-8)); + assert.epsilon(acosh(1234), 7.811163220849231); + assert.epsilon(acosh(8.88), 2.8737631531629235); + assert.epsilon(acosh(1e+160), 369.10676205960726); + assert.epsilon(acosh(Number.MAX_VALUE), 710.475860073944); + return assert.epsilon(acosh(1 + core.Number.EPSILON), 2.1073424255447017e-8); }); }).call(this); @@ -2115,10 +2112,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.asinh', function(assert){ - var epsilon, asinh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var asinh; asinh = core.Math.asinh; assert.ok(toString$.call(asinh).slice(8, -1) === 'Function', 'is function'); assert.same(asinh(NaN), NaN); @@ -2126,11 +2120,11 @@ assert.same(asinh(-0), -0); assert.strictEqual(asinh(Infinity), Infinity); assert.strictEqual(asinh(-Infinity), -Infinity); - assert.ok(epsilon(asinh(1234), 7.811163549201245)); - assert.ok(epsilon(asinh(9.99), 2.997227420191335)); - assert.ok(epsilon(asinh(1e150), 346.0809111296668)); - assert.ok(epsilon(asinh(1e7), 16.811242831518268)); - return assert.ok(epsilon(asinh(-1e7), -16.811242831518268)); + assert.epsilon(asinh(1234), 7.811163549201245); + assert.epsilon(asinh(9.99), 2.997227420191335); + assert.epsilon(asinh(1e150), 346.0809111296668); + assert.epsilon(asinh(1e7), 16.811242831518268); + return assert.epsilon(asinh(-1e7), -16.811242831518268); }); }).call(this); @@ -2140,10 +2134,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.atanh', function(assert){ - var epsilon, atanh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var atanh; atanh = core.Math.atanh; assert.ok(toString$.call(atanh).slice(8, -1) === 'Function', 'is function'); assert.same(atanh(NaN), NaN); @@ -2157,9 +2148,9 @@ assert.same(atanh(-0), -0); assert.same(atanh(-1e300), NaN); assert.same(atanh(1e300), NaN); - assert.ok(epsilon(atanh(0.5), 0.5493061443340549)); - assert.ok(epsilon(atanh(-0.5), -0.5493061443340549)); - return assert.ok(epsilon(atanh(0.444), 0.47720201260109457)); + assert.epsilon(atanh(0.5), 0.5493061443340549); + assert.epsilon(atanh(-0.5), -0.5493061443340549); + return assert.epsilon(atanh(0.444), 0.47720201260109457); }); }).call(this); @@ -2169,10 +2160,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.cbrt', function(assert){ - var epsilon, cbrt; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var cbrt; cbrt = core.Math.cbrt; assert.ok(toString$.call(cbrt).slice(8, -1) === 'Function', 'is function'); assert.same(cbrt(NaN), NaN); @@ -2182,8 +2170,8 @@ assert.strictEqual(cbrt(-Infinity), -Infinity); assert.strictEqual(cbrt(-8), -2); assert.strictEqual(cbrt(8), 2); - assert.ok(epsilon(cbrt(-1000), -10)); - return assert.ok(epsilon(cbrt(1000), 10)); + assert.epsilon(cbrt(-1000), -10); + return assert.epsilon(cbrt(1000), 10); }); }).call(this); @@ -2211,10 +2199,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.cosh', function(assert){ - var epsilon, cosh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var cosh; cosh = core.Math.cosh; assert.ok(toString$.call(cosh).slice(8, -1) === 'Function', 'is function'); assert.same(cosh(NaN), NaN); @@ -2222,10 +2207,10 @@ assert.strictEqual(cosh(-0), 1); assert.strictEqual(cosh(Infinity), Infinity); assert.strictEqual(cosh(-Infinity), Infinity); - assert.ok(epsilon(cosh(12), 81377.39571257407, 3e-11)); - assert.ok(epsilon(cosh(22), 1792456423.065795780980053377, 1e-5)); - assert.ok(epsilon(cosh(-10), 11013.23292010332313972137)); - return assert.ok(epsilon(cosh(-23), 4872401723.1244513000, 1e-5)); + assert.epsilon(cosh(12), 81377.39571257407, 3e-11); + assert.epsilon(cosh(22), 1792456423.065795780980053377, 1e-5); + assert.epsilon(cosh(-10), 11013.23292010332313972137); + return assert.epsilon(cosh(-23), 4872401723.1244513000, 1e-5); }); }).call(this); @@ -2235,10 +2220,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.expm1', function(assert){ - var epsilon, expm1; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var expm1; expm1 = core.Math.expm1; assert.ok(toString$.call(expm1).slice(8, -1) === 'Function', 'is function'); assert.same(expm1(NaN), NaN); @@ -2246,7 +2228,7 @@ assert.same(expm1(-0), -0); assert.strictEqual(expm1(Infinity), Infinity); assert.strictEqual(expm1(-Infinity), -1); - return assert.ok(epsilon(expm1(10), 22025.465794806718, assert.ok(epsilon(expm1(-10), -0.9999546000702375)))); + return assert.epsilon(expm1(10), 22025.465794806718, assert.epsilon(expm1(-10), -0.9999546000702375)); }); }).call(this); @@ -2292,10 +2274,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.hypot', function(assert){ - var epsilon, hypot, sqrt; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var hypot, sqrt; hypot = core.Math.hypot; sqrt = Math.sqrt; assert.ok(toString$.call(hypot).slice(8, -1) === 'Function', 'is function'); @@ -2327,8 +2306,8 @@ assert.strictEqual(hypot(1, 0, 0), 1); assert.strictEqual(hypot(2, 3, 4), sqrt(2 * 2 + 3 * 3 + 4 * 4)); assert.strictEqual(hypot(2, 3, 4, 5), sqrt(2 * 2 + 3 * 3 + 4 * 4 + 5 * 5)); - assert.ok(epsilon(hypot(66, 66), 93.33809511662427)); - assert.ok(epsilon(hypot(0.1, 100), 100.0000499999875)); + assert.epsilon(hypot(66, 66), 93.33809511662427); + assert.epsilon(hypot(0.1, 100), 100.0000499999875); assert.strictEqual(hypot(1e+300, 1e+300), 1.4142135623730952e+300); assert.strictEqual(Math.floor(hypot(1e-300, 1e-300) * 1e308), 141421356); assert.strictEqual(hypot(1e+300, 1e+300, 2, 3), 1.4142135623730952e+300); @@ -2390,10 +2369,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.log10', function(assert){ - var epsilon, log10; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var log10; log10 = core.Math.log10; assert.ok(toString$.call(log10).slice(8, -1) === 'Function', 'is function'); assert.same(log10(''), log10(0)); @@ -2403,11 +2379,11 @@ assert.same(log10(-0), -Infinity); assert.same(log10(1), 0); assert.same(log10(Infinity), Infinity); - assert.ok(epsilon(log10(0.1), -1)); - assert.ok(epsilon(log10(0.5), -0.3010299956639812)); - assert.ok(epsilon(log10(1.5), 0.17609125905568124)); - assert.ok(epsilon(log10(5), 0.6989700043360189)); - return assert.ok(epsilon(log10(50), 1.6989700043360187)); + assert.epsilon(log10(0.1), -1); + assert.epsilon(log10(0.5), -0.3010299956639812); + assert.epsilon(log10(1.5), 0.17609125905568124); + assert.epsilon(log10(5), 0.6989700043360189); + return assert.epsilon(log10(50), 1.6989700043360187); }); }).call(this); @@ -2417,10 +2393,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.log1p', function(assert){ - var epsilon, log1p; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var log1p; log1p = core.Math.log1p; assert.ok(toString$.call(log1p).slice(8, -1) === 'Function', 'is function'); assert.same(log1p(''), log1p(0)); @@ -2430,8 +2403,8 @@ assert.same(log1p(0), 0); assert.same(log1p(-0), -0); assert.same(log1p(Infinity), Infinity); - assert.ok(epsilon(log1p(5), 1.791759469228055)); - return assert.ok(epsilon(log1p(50), 3.9318256327243257)); + assert.epsilon(log1p(5), 1.791759469228055); + return assert.epsilon(log1p(50), 3.9318256327243257); }); }).call(this); @@ -2441,10 +2414,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.log2', function(assert){ - var epsilon, log2; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var log2; log2 = core.Math.log2; assert.ok(toString$.call(log2).slice(8, -1) === 'Function', 'is function'); assert.same(log2(''), log2(0)); @@ -2456,7 +2426,7 @@ assert.same(log2(Infinity), Infinity); assert.same(log2(0.5), -1); assert.same(log2(32), 5); - return assert.ok(epsilon(log2(5), 2.321928094887362)); + return assert.epsilon(log2(5), 2.321928094887362); }); }).call(this); @@ -2488,10 +2458,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.sinh', function(assert){ - var epsilon, sinh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var sinh; sinh = core.Math.sinh; assert.ok(toString$.call(sinh).slice(8, -1) === 'Function', 'is function'); assert.same(sinh(NaN), NaN); @@ -2499,8 +2466,8 @@ assert.same(sinh(-0), -0); assert.strictEqual(sinh(Infinity), Infinity); assert.strictEqual(sinh(-Infinity), -Infinity); - assert.ok(epsilon(sinh(-5), -74.20321057778875)); - assert.ok(epsilon(sinh(2), 3.6268604078470186)); + assert.epsilon(sinh(-5), -74.20321057778875); + assert.epsilon(sinh(2), 3.6268604078470186); return assert.strictEqual(sinh(-2e-17), -2e-17); }); }).call(this); @@ -2511,10 +2478,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.tanh', function(assert){ - var epsilon, tanh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var tanh; tanh = core.Math.tanh; assert.ok(toString$.call(tanh).slice(8, -1) === 'Function', 'is function'); assert.same(tanh(NaN), NaN); @@ -2522,7 +2486,7 @@ assert.same(tanh(-0), -0); assert.strictEqual(tanh(Infinity), 1); assert.strictEqual(tanh(90), 1); - return assert.ok(epsilon(tanh(10), 0.9999999958776927)); + return assert.epsilon(tanh(10), 0.9999999958776927); }); }).call(this); diff --git a/tests/library/es6.math.acosh.ls b/tests/library/es6.math.acosh.ls index fff42cfc7982..29ed518087ce 100644 --- a/tests/library/es6.math.acosh.ls +++ b/tests/library/es6.math.acosh.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the inverse hyperbolic cosine of x. test 'Math.acosh' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {acosh} = core.Math assert.ok typeof! acosh is \Function, 'is function' assert.same acosh(NaN), NaN @@ -11,8 +10,8 @@ test 'Math.acosh' (assert)-> assert.same acosh(-1e300), NaN assert.same acosh(1), 0 assert.strictEqual acosh(Infinity), Infinity - assert.ok epsilon acosh(1234), 7.811163220849231 - assert.ok epsilon acosh(8.88), 2.8737631531629235 - assert.ok epsilon acosh(1e+160), 369.10676205960726 - assert.ok epsilon acosh(Number.MAX_VALUE), 710.475860073944 #buggy v8 implementation - assert.ok epsilon acosh(1 + core.Number.EPSILON), 2.1073424255447017e-8 \ No newline at end of file + assert.epsilon acosh(1234), 7.811163220849231 + assert.epsilon acosh(8.88), 2.8737631531629235 + assert.epsilon acosh(1e+160), 369.10676205960726 + assert.epsilon acosh(Number.MAX_VALUE), 710.475860073944 #buggy v8 implementation + assert.epsilon acosh(1 + core.Number.EPSILON), 2.1073424255447017e-8 \ No newline at end of file diff --git a/tests/library/es6.math.asinh.ls b/tests/library/es6.math.asinh.ls index ed105370eec0..715a027d7053 100644 --- a/tests/library/es6.math.asinh.ls +++ b/tests/library/es6.math.asinh.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the inverse hyperbolic sine of x. test 'Math.asinh' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {asinh} = core.Math assert.ok typeof! asinh is \Function, 'is function' assert.same asinh(NaN), NaN @@ -10,8 +9,8 @@ test 'Math.asinh' (assert)-> assert.same asinh(-0), -0 assert.strictEqual asinh(Infinity), Infinity assert.strictEqual asinh(-Infinity), -Infinity - assert.ok epsilon asinh(1234), 7.811163549201245 - assert.ok epsilon asinh(9.99), 2.997227420191335 - assert.ok epsilon asinh(1e150), 346.0809111296668 - assert.ok epsilon asinh(1e7), 16.811242831518268 - assert.ok epsilon asinh(-1e7), -16.811242831518268 \ No newline at end of file + assert.epsilon asinh(1234), 7.811163549201245 + assert.epsilon asinh(9.99), 2.997227420191335 + assert.epsilon asinh(1e150), 346.0809111296668 + assert.epsilon asinh(1e7), 16.811242831518268 + assert.epsilon asinh(-1e7), -16.811242831518268 \ No newline at end of file diff --git a/tests/library/es6.math.atanh.ls b/tests/library/es6.math.atanh.ls index 5b28e9564bd7..5aedbe12676a 100644 --- a/tests/library/es6.math.atanh.ls +++ b/tests/library/es6.math.atanh.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the inverse hyperbolic tangent of x. test 'Math.atanh' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {atanh} = core.Math assert.ok typeof! atanh is \Function, 'is function' assert.same atanh(NaN), NaN @@ -16,6 +15,6 @@ test 'Math.atanh' (assert)-> assert.same atanh(-0), -0 assert.same atanh(-1e300), NaN assert.same atanh(1e300), NaN - assert.ok epsilon atanh(0.5), 0.5493061443340549 - assert.ok epsilon atanh(-0.5), -0.5493061443340549 - assert.ok epsilon atanh(0.444), 0.47720201260109457 \ No newline at end of file + assert.epsilon atanh(0.5), 0.5493061443340549 + assert.epsilon atanh(-0.5), -0.5493061443340549 + assert.epsilon atanh(0.444), 0.47720201260109457 \ No newline at end of file diff --git a/tests/library/es6.math.cbrt.ls b/tests/library/es6.math.cbrt.ls index 18cad43c9ee3..65289e157fd1 100644 --- a/tests/library/es6.math.cbrt.ls +++ b/tests/library/es6.math.cbrt.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the cube root of x. test 'Math.cbrt' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {cbrt} = core.Math assert.ok typeof! cbrt is \Function, 'is function' assert.same cbrt(NaN), NaN @@ -12,5 +11,5 @@ test 'Math.cbrt' (assert)-> assert.strictEqual cbrt(-Infinity), -Infinity assert.strictEqual cbrt(-8), -2 assert.strictEqual cbrt(8), 2 - assert.ok epsilon cbrt(-1000), -10 # O_o - assert.ok epsilon cbrt(1000), 10 # O_o \ No newline at end of file + assert.epsilon cbrt(-1000), -10 # O_o + assert.epsilon cbrt(1000), 10 # O_o \ No newline at end of file diff --git a/tests/library/es6.math.cosh.ls b/tests/library/es6.math.cosh.ls index 89f679d2ec1d..b875df210596 100644 --- a/tests/library/es6.math.cosh.ls +++ b/tests/library/es6.math.cosh.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the hyperbolic cosine of x. test 'Math.cosh' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {cosh} = core.Math assert.ok typeof! cosh is \Function, 'is function' assert.same cosh(NaN), NaN @@ -10,7 +9,7 @@ test 'Math.cosh' (assert)-> assert.strictEqual cosh(-0), 1 assert.strictEqual cosh(Infinity), Infinity assert.strictEqual cosh(-Infinity), Infinity # v8 bug! - assert.ok epsilon cosh(12), 81377.39571257407, 3e-11 - assert.ok epsilon cosh(22), 1792456423.065795780980053377, 1e-5 - assert.ok epsilon cosh(-10), 11013.23292010332313972137 - assert.ok epsilon cosh(-23), 4872401723.1244513000, 1e-5 \ No newline at end of file + assert.epsilon cosh(12), 81377.39571257407, 3e-11 + assert.epsilon cosh(22), 1792456423.065795780980053377, 1e-5 + assert.epsilon cosh(-10), 11013.23292010332313972137 + assert.epsilon cosh(-23), 4872401723.1244513000, 1e-5 \ No newline at end of file diff --git a/tests/library/es6.math.expm1.ls b/tests/library/es6.math.expm1.ls index a883af1506e9..5ac3debb406d 100644 --- a/tests/library/es6.math.expm1.ls +++ b/tests/library/es6.math.expm1.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to subtracting 1 from the exponential function of x test 'Math.expm1' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {expm1} = core.Math assert.ok typeof! expm1 is \Function, 'is function' assert.same expm1(NaN), NaN @@ -10,5 +9,5 @@ test 'Math.expm1' (assert)-> assert.same expm1(-0), -0 assert.strictEqual expm1(Infinity), Infinity assert.strictEqual expm1(-Infinity), -1 - assert.ok epsilon expm1(10), 22025.465794806718, - assert.ok epsilon expm1(-10), -0.9999546000702375 \ No newline at end of file + assert.epsilon expm1(10), 22025.465794806718, + assert.epsilon expm1(-10), -0.9999546000702375 \ No newline at end of file diff --git a/tests/library/es6.math.hypot.ls b/tests/library/es6.math.hypot.ls index def2e2c4e007..080c52a8c8ae 100644 --- a/tests/library/es6.math.hypot.ls +++ b/tests/library/es6.math.hypot.ls @@ -2,7 +2,6 @@ module \ES6 # Math.hypot returns an implementation-dependent approximation of the square root of the sum of squares of its arguments. test 'Math.hypot' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {hypot} = core.Math {sqrt} = Math assert.ok typeof! hypot is \Function, 'is function' @@ -34,8 +33,8 @@ test 'Math.hypot' (assert)-> assert.strictEqual hypot(1 0 0), 1 assert.strictEqual hypot(2 3 4), sqrt(2 * 2 + 3 * 3 + 4 * 4) assert.strictEqual hypot(2 3 4 5), sqrt(2 * 2 + 3 * 3 + 4 * 4 + 5 * 5) - assert.ok epsilon hypot(66 66), 93.33809511662427 - assert.ok epsilon hypot(0.1 100), 100.0000499999875 + assert.epsilon hypot(66 66), 93.33809511662427 + assert.epsilon hypot(0.1 100), 100.0000499999875 assert.strictEqual hypot(1e+300, 1e+300), 1.4142135623730952e+300 assert.strictEqual Math.floor(hypot(1e-300, 1e-300) * 1e308), 141421356 assert.strictEqual hypot(1e+300, 1e+300, 2, 3), 1.4142135623730952e+300 diff --git a/tests/library/es6.math.log10.ls b/tests/library/es6.math.log10.ls index 247111a5a809..a906b2372a90 100644 --- a/tests/library/es6.math.log10.ls +++ b/tests/library/es6.math.log10.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the base 10 logarithm of x. test 'Math.log10' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {log10} = core.Math assert.ok typeof! log10 is \Function, 'is function' assert.same log10(''), log10 0 @@ -12,8 +11,8 @@ test 'Math.log10' (assert)-> assert.same log10(-0), -Infinity assert.same log10(1), 0 assert.same log10(Infinity), Infinity - assert.ok epsilon log10(0.1), -1 # O_o - assert.ok epsilon log10(0.5), -0.3010299956639812 - assert.ok epsilon log10(1.5), 0.17609125905568124 - assert.ok epsilon log10(5), 0.6989700043360189 - assert.ok epsilon log10(50), 1.6989700043360187 \ No newline at end of file + assert.epsilon log10(0.1), -1 # O_o + assert.epsilon log10(0.5), -0.3010299956639812 + assert.epsilon log10(1.5), 0.17609125905568124 + assert.epsilon log10(5), 0.6989700043360189 + assert.epsilon log10(50), 1.6989700043360187 \ No newline at end of file diff --git a/tests/library/es6.math.log1p.ls b/tests/library/es6.math.log1p.ls index aebaee93d1c6..81ee852dc6ff 100644 --- a/tests/library/es6.math.log1p.ls +++ b/tests/library/es6.math.log1p.ls @@ -3,7 +3,6 @@ module \ES6 # Returns an implementation-dependent approximation to the natural logarithm of 1 + x. # The result is computed in a way that is accurate even when the value of x is close to zero. test 'Math.log1p' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {log1p} = core.Math assert.ok typeof! log1p is \Function, 'is function' assert.same log1p(''), log1p 0 @@ -13,5 +12,5 @@ test 'Math.log1p' (assert)-> assert.same log1p(0), 0 assert.same log1p(-0), -0 assert.same log1p(Infinity), Infinity - assert.ok epsilon log1p(5), 1.791759469228055 - assert.ok epsilon log1p(50), 3.9318256327243257 \ No newline at end of file + assert.epsilon log1p(5), 1.791759469228055 + assert.epsilon log1p(50), 3.9318256327243257 \ No newline at end of file diff --git a/tests/library/es6.math.log2.ls b/tests/library/es6.math.log2.ls index 2814ddc4e68d..80dacf780738 100644 --- a/tests/library/es6.math.log2.ls +++ b/tests/library/es6.math.log2.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the base 2 logarithm of x. test 'Math.log2' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {log2} = core.Math assert.ok typeof! log2 is \Function, 'is function' assert.same log2(''), log2 0 @@ -14,4 +13,4 @@ test 'Math.log2' (assert)-> assert.same log2(Infinity), Infinity assert.same log2(0.5), -1 assert.same log2(32), 5 - assert.ok epsilon log2(5), 2.321928094887362 \ No newline at end of file + assert.epsilon log2(5), 2.321928094887362 \ No newline at end of file diff --git a/tests/library/es6.math.sinh.ls b/tests/library/es6.math.sinh.ls index 5fee6cc412ad..ece79008d0e1 100644 --- a/tests/library/es6.math.sinh.ls +++ b/tests/library/es6.math.sinh.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the hyperbolic sine of x. test 'Math.sinh' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {sinh} = core.Math assert.ok typeof! sinh is \Function, 'is function' assert.same sinh(NaN), NaN @@ -10,6 +9,6 @@ test 'Math.sinh' (assert)-> assert.same sinh(-0), -0 assert.strictEqual sinh(Infinity), Infinity assert.strictEqual sinh(-Infinity), -Infinity - assert.ok epsilon sinh(-5), -74.20321057778875 - assert.ok epsilon sinh(2), 3.6268604078470186 + assert.epsilon sinh(-5), -74.20321057778875 + assert.epsilon sinh(2), 3.6268604078470186 assert.strictEqual sinh(-2e-17), -2e-17 \ No newline at end of file diff --git a/tests/library/es6.math.tanh.ls b/tests/library/es6.math.tanh.ls index 01f859118160..56ab725c40a9 100644 --- a/tests/library/es6.math.tanh.ls +++ b/tests/library/es6.math.tanh.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the hyperbolic tangent of x. test 'Math.tanh' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {tanh} = core.Math assert.ok typeof! tanh is \Function, 'is function' assert.same tanh(NaN), NaN @@ -10,5 +9,5 @@ test 'Math.tanh' (assert)-> assert.same tanh(-0), -0 assert.strictEqual tanh(Infinity), 1 assert.strictEqual tanh(90), 1 - assert.ok epsilon tanh(10), 0.9999999958776927 + assert.epsilon tanh(10), 0.9999999958776927 #assert.strictEqual tanh(710), 1 #buggy v8 implementation \ No newline at end of file diff --git a/tests/tests.js b/tests/tests.js index 1ac942c46081..6a4fbbc0bf15 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -2162,10 +2162,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.acosh', function(assert){ - var epsilon, acosh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var acosh; acosh = Math.acosh; assert.ok(toString$.call(acosh).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(acosh.name, 'acosh', 'name is "acosh"'); @@ -2177,11 +2174,11 @@ assert.same(acosh(-1e300), NaN); assert.same(acosh(1), 0); assert.strictEqual(acosh(Infinity), Infinity); - assert.ok(epsilon(acosh(1234), 7.811163220849231)); - assert.ok(epsilon(acosh(8.88), 2.8737631531629235)); - assert.ok(epsilon(acosh(1e+160), 369.10676205960726)); - assert.ok(epsilon(acosh(Number.MAX_VALUE), 710.475860073944)); - return assert.ok(epsilon(acosh(1 + Number.EPSILON), 2.1073424255447017e-8)); + assert.epsilon(acosh(1234), 7.811163220849231); + assert.epsilon(acosh(8.88), 2.8737631531629235); + assert.epsilon(acosh(1e+160), 369.10676205960726); + assert.epsilon(acosh(Number.MAX_VALUE), 710.475860073944); + return assert.epsilon(acosh(1 + Number.EPSILON), 2.1073424255447017e-8); }); }).call(this); @@ -2191,10 +2188,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.asinh', function(assert){ - var epsilon, asinh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var asinh; asinh = Math.asinh; assert.ok(toString$.call(asinh).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(asinh.name, 'asinh', 'name is "asinh"'); @@ -2205,11 +2199,11 @@ assert.same(asinh(-0), -0); assert.strictEqual(asinh(Infinity), Infinity); assert.strictEqual(asinh(-Infinity), -Infinity); - assert.ok(epsilon(asinh(1234), 7.811163549201245)); - assert.ok(epsilon(asinh(9.99), 2.997227420191335)); - assert.ok(epsilon(asinh(1e150), 346.0809111296668)); - assert.ok(epsilon(asinh(1e7), 16.811242831518268)); - return assert.ok(epsilon(asinh(-1e7), -16.811242831518268)); + assert.epsilon(asinh(1234), 7.811163549201245); + assert.epsilon(asinh(9.99), 2.997227420191335); + assert.epsilon(asinh(1e150), 346.0809111296668); + assert.epsilon(asinh(1e7), 16.811242831518268); + return assert.epsilon(asinh(-1e7), -16.811242831518268); }); }).call(this); @@ -2219,10 +2213,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.atanh', function(assert){ - var epsilon, atanh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var atanh; atanh = Math.atanh; assert.ok(toString$.call(atanh).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(atanh.name, 'atanh', 'name is "atanh"'); @@ -2239,9 +2230,9 @@ assert.same(atanh(-0), -0); assert.same(atanh(-1e300), NaN); assert.same(atanh(1e300), NaN); - assert.ok(epsilon(atanh(0.5), 0.5493061443340549)); - assert.ok(epsilon(atanh(-0.5), -0.5493061443340549)); - return assert.ok(epsilon(atanh(0.444), 0.47720201260109457)); + assert.epsilon(atanh(0.5), 0.5493061443340549); + assert.epsilon(atanh(-0.5), -0.5493061443340549); + return assert.epsilon(atanh(0.444), 0.47720201260109457); }); }).call(this); @@ -2251,10 +2242,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.cbrt', function(assert){ - var epsilon, cbrt; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var cbrt; cbrt = Math.cbrt; assert.ok(toString$.call(cbrt).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(cbrt.name, 'cbrt', 'name is "cbrt"'); @@ -2267,8 +2255,8 @@ assert.strictEqual(cbrt(-Infinity), -Infinity); assert.strictEqual(cbrt(-8), -2); assert.strictEqual(cbrt(8), 2); - assert.ok(epsilon(cbrt(-1000), -10)); - return assert.ok(epsilon(cbrt(1000), 10)); + assert.epsilon(cbrt(-1000), -10); + return assert.epsilon(cbrt(1000), 10); }); }).call(this); @@ -2299,10 +2287,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.cosh', function(assert){ - var epsilon, cosh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var cosh; cosh = Math.cosh; assert.ok(toString$.call(cosh).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(cosh.name, 'cosh', 'name is "cosh"'); @@ -2313,10 +2298,10 @@ assert.strictEqual(cosh(-0), 1); assert.strictEqual(cosh(Infinity), Infinity); assert.strictEqual(cosh(-Infinity), Infinity); - assert.ok(epsilon(cosh(12), 81377.39571257407, 3e-11)); - assert.ok(epsilon(cosh(22), 1792456423.065795780980053377, 1e-5)); - assert.ok(epsilon(cosh(-10), 11013.23292010332313972137)); - return assert.ok(epsilon(cosh(-23), 4872401723.1244513000, 1e-5)); + assert.epsilon(cosh(12), 81377.39571257407, 3e-11); + assert.epsilon(cosh(22), 1792456423.065795780980053377, 1e-5); + assert.epsilon(cosh(-10), 11013.23292010332313972137); + return assert.epsilon(cosh(-23), 4872401723.1244513000, 1e-5); }); }).call(this); @@ -2326,10 +2311,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.expm1', function(assert){ - var epsilon, expm1; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var expm1; expm1 = Math.expm1; assert.ok(toString$.call(expm1).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(expm1.name, 'expm1', 'name is "expm1"'); @@ -2340,7 +2322,7 @@ assert.same(expm1(-0), -0); assert.strictEqual(expm1(Infinity), Infinity); assert.strictEqual(expm1(-Infinity), -1); - return assert.ok(epsilon(expm1(10), 22025.465794806718, assert.ok(epsilon(expm1(-10), -0.9999546000702375)))); + return assert.epsilon(expm1(10), 22025.465794806718, assert.epsilon(expm1(-10), -0.9999546000702375)); }); }).call(this); @@ -2389,10 +2371,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.hypot', function(assert){ - var epsilon, hypot, sqrt; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var hypot, sqrt; hypot = Math.hypot, sqrt = Math.sqrt; assert.ok(toString$.call(hypot).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(hypot.name, 'hypot', 'name is "hypot"'); @@ -2426,8 +2405,8 @@ assert.strictEqual(hypot(1, 0, 0), 1); assert.strictEqual(hypot(2, 3, 4), sqrt(2 * 2 + 3 * 3 + 4 * 4)); assert.strictEqual(hypot(2, 3, 4, 5), sqrt(2 * 2 + 3 * 3 + 4 * 4 + 5 * 5)); - assert.ok(epsilon(hypot(66, 66), 93.33809511662427)); - assert.ok(epsilon(hypot(0.1, 100), 100.0000499999875)); + assert.epsilon(hypot(66, 66), 93.33809511662427); + assert.epsilon(hypot(0.1, 100), 100.0000499999875); assert.strictEqual(hypot(1e+300, 1e+300), 1.4142135623730952e+300); assert.strictEqual(Math.floor(hypot(1e-300, 1e-300) * 1e308), 141421356); assert.strictEqual(hypot(1e+300, 1e+300, 2, 3), 1.4142135623730952e+300); @@ -2492,10 +2471,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.log10', function(assert){ - var epsilon, log10; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var log10; log10 = Math.log10; assert.ok(toString$.call(log10).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(log10.name, 'log10', 'name is "log10"'); @@ -2508,11 +2484,11 @@ assert.same(log10(-0), -Infinity); assert.same(log10(1), 0); assert.same(log10(Infinity), Infinity); - assert.ok(epsilon(log10(0.1), -1)); - assert.ok(epsilon(log10(0.5), -0.3010299956639812)); - assert.ok(epsilon(log10(1.5), 0.17609125905568124)); - assert.ok(epsilon(log10(5), 0.6989700043360189)); - return assert.ok(epsilon(log10(50), 1.6989700043360187)); + assert.epsilon(log10(0.1), -1); + assert.epsilon(log10(0.5), -0.3010299956639812); + assert.epsilon(log10(1.5), 0.17609125905568124); + assert.epsilon(log10(5), 0.6989700043360189); + return assert.epsilon(log10(50), 1.6989700043360187); }); }).call(this); @@ -2522,10 +2498,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.log1p', function(assert){ - var epsilon, log1p; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var log1p; log1p = Math.log1p; assert.ok(toString$.call(log1p).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(log1p.name, 'log1p', 'name is "log1p"'); @@ -2538,8 +2511,8 @@ assert.same(log1p(0), 0); assert.same(log1p(-0), -0); assert.same(log1p(Infinity), Infinity); - assert.ok(epsilon(log1p(5), 1.791759469228055)); - return assert.ok(epsilon(log1p(50), 3.9318256327243257)); + assert.epsilon(log1p(5), 1.791759469228055); + return assert.epsilon(log1p(50), 3.9318256327243257); }); }).call(this); @@ -2549,10 +2522,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.log2', function(assert){ - var epsilon, log2; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var log2; log2 = Math.log2; assert.ok(toString$.call(log2).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(log2.name, 'log2', 'name is "log2"'); @@ -2567,7 +2537,7 @@ assert.same(log2(Infinity), Infinity); assert.same(log2(0.5), -1); assert.same(log2(32), 5); - return assert.ok(epsilon(log2(5), 2.321928094887362)); + return assert.epsilon(log2(5), 2.321928094887362); }); }).call(this); @@ -2602,10 +2572,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.sinh', function(assert){ - var epsilon, sinh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var sinh; sinh = Math.sinh; assert.ok(toString$.call(sinh).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(sinh.name, 'sinh', 'name is "sinh"'); @@ -2616,8 +2583,8 @@ assert.same(sinh(-0), -0); assert.strictEqual(sinh(Infinity), Infinity); assert.strictEqual(sinh(-Infinity), -Infinity); - assert.ok(epsilon(sinh(-5), -74.20321057778875)); - assert.ok(epsilon(sinh(2), 3.6268604078470186)); + assert.epsilon(sinh(-5), -74.20321057778875); + assert.epsilon(sinh(2), 3.6268604078470186); return assert.strictEqual(sinh(-2e-17), -2e-17); }); }).call(this); @@ -2628,10 +2595,7 @@ module = QUnit.module, test = QUnit.test; module('ES6'); test('Math.tanh', function(assert){ - var epsilon, tanh; - epsilon = function(a, b, E){ - return Math.abs(a - b) <= (E != null ? E : 1e-11); - }; + var tanh; tanh = Math.tanh; assert.ok(toString$.call(tanh).slice(8, -1) === 'Function', 'is function'); assert.strictEqual(tanh.name, 'tanh', 'name is "tanh"'); @@ -2642,7 +2606,7 @@ assert.same(tanh(-0), -0); assert.strictEqual(tanh(Infinity), 1); assert.strictEqual(tanh(90), 1); - return assert.ok(epsilon(tanh(10), 0.9999999958776927)); + return assert.epsilon(tanh(10), 0.9999999958776927); }); }).call(this); diff --git a/tests/tests/es6.math.acosh.ls b/tests/tests/es6.math.acosh.ls index d0d33a8bd974..f2948499f6b2 100644 --- a/tests/tests/es6.math.acosh.ls +++ b/tests/tests/es6.math.acosh.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the inverse hyperbolic cosine of x. test 'Math.acosh' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {acosh} = Math assert.ok typeof! acosh is \Function, 'is function' assert.strictEqual acosh.name, \acosh, 'name is "acosh"' @@ -14,8 +13,8 @@ test 'Math.acosh' (assert)-> assert.same acosh(-1e300), NaN assert.same acosh(1), 0 assert.strictEqual acosh(Infinity), Infinity - assert.ok epsilon acosh(1234), 7.811163220849231 - assert.ok epsilon acosh(8.88), 2.8737631531629235 - assert.ok epsilon acosh(1e+160), 369.10676205960726 - assert.ok epsilon acosh(Number.MAX_VALUE), 710.475860073944 #buggy v8 implementation - assert.ok epsilon acosh(1 + Number.EPSILON), 2.1073424255447017e-8 \ No newline at end of file + assert.epsilon acosh(1234), 7.811163220849231 + assert.epsilon acosh(8.88), 2.8737631531629235 + assert.epsilon acosh(1e+160), 369.10676205960726 + assert.epsilon acosh(Number.MAX_VALUE), 710.475860073944 #buggy v8 implementation + assert.epsilon acosh(1 + Number.EPSILON), 2.1073424255447017e-8 \ No newline at end of file diff --git a/tests/tests/es6.math.asinh.ls b/tests/tests/es6.math.asinh.ls index a1651046f235..ebafda9cf821 100644 --- a/tests/tests/es6.math.asinh.ls +++ b/tests/tests/es6.math.asinh.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the inverse hyperbolic sine of x. test 'Math.asinh' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {asinh} = Math assert.ok typeof! asinh is \Function, 'is function' assert.strictEqual asinh.name, \asinh, 'name is "asinh"' @@ -13,8 +12,8 @@ test 'Math.asinh' (assert)-> assert.same asinh(-0), -0 assert.strictEqual asinh(Infinity), Infinity assert.strictEqual asinh(-Infinity), -Infinity - assert.ok epsilon asinh(1234), 7.811163549201245 - assert.ok epsilon asinh(9.99), 2.997227420191335 - assert.ok epsilon asinh(1e150), 346.0809111296668 - assert.ok epsilon asinh(1e7), 16.811242831518268 - assert.ok epsilon asinh(-1e7), -16.811242831518268 \ No newline at end of file + assert.epsilon asinh(1234), 7.811163549201245 + assert.epsilon asinh(9.99), 2.997227420191335 + assert.epsilon asinh(1e150), 346.0809111296668 + assert.epsilon asinh(1e7), 16.811242831518268 + assert.epsilon asinh(-1e7), -16.811242831518268 \ No newline at end of file diff --git a/tests/tests/es6.math.atanh.ls b/tests/tests/es6.math.atanh.ls index 9a25492f5951..e15ddaa67e7a 100644 --- a/tests/tests/es6.math.atanh.ls +++ b/tests/tests/es6.math.atanh.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the inverse hyperbolic tangent of x. test 'Math.atanh' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {atanh} = Math assert.ok typeof! atanh is \Function, 'is function' assert.strictEqual atanh.name, \atanh, 'name is "atanh"' @@ -19,6 +18,6 @@ test 'Math.atanh' (assert)-> assert.same atanh(-0), -0 assert.same atanh(-1e300), NaN assert.same atanh(1e300), NaN - assert.ok epsilon atanh(0.5), 0.5493061443340549 - assert.ok epsilon atanh(-0.5), -0.5493061443340549 - assert.ok epsilon atanh(0.444), 0.47720201260109457 \ No newline at end of file + assert.epsilon atanh(0.5), 0.5493061443340549 + assert.epsilon atanh(-0.5), -0.5493061443340549 + assert.epsilon atanh(0.444), 0.47720201260109457 \ No newline at end of file diff --git a/tests/tests/es6.math.cbrt.ls b/tests/tests/es6.math.cbrt.ls index f4e78c5904ae..26703292cac3 100644 --- a/tests/tests/es6.math.cbrt.ls +++ b/tests/tests/es6.math.cbrt.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the cube root of x. test 'Math.cbrt' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {cbrt} = Math assert.ok typeof! cbrt is \Function, 'is function' assert.strictEqual cbrt.name, \cbrt, 'name is "cbrt"' @@ -15,5 +14,5 @@ test 'Math.cbrt' (assert)-> assert.strictEqual cbrt(-Infinity), -Infinity assert.strictEqual cbrt(-8), -2 assert.strictEqual cbrt(8), 2 - assert.ok epsilon cbrt(-1000), -10 # O_o - assert.ok epsilon cbrt(1000), 10 # O_o \ No newline at end of file + assert.epsilon cbrt(-1000), -10 # O_o + assert.epsilon cbrt(1000), 10 # O_o \ No newline at end of file diff --git a/tests/tests/es6.math.cosh.ls b/tests/tests/es6.math.cosh.ls index 22db9dd259bc..88e0c376558a 100644 --- a/tests/tests/es6.math.cosh.ls +++ b/tests/tests/es6.math.cosh.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the hyperbolic cosine of x. test 'Math.cosh' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {cosh} = Math assert.ok typeof! cosh is \Function, 'is function' assert.strictEqual cosh.name, \cosh, 'name is "cosh"' @@ -13,7 +12,7 @@ test 'Math.cosh' (assert)-> assert.strictEqual cosh(-0), 1 assert.strictEqual cosh(Infinity), Infinity assert.strictEqual cosh(-Infinity), Infinity # v8 bug! - assert.ok epsilon cosh(12), 81377.39571257407, 3e-11 - assert.ok epsilon cosh(22), 1792456423.065795780980053377, 1e-5 - assert.ok epsilon cosh(-10), 11013.23292010332313972137 - assert.ok epsilon cosh(-23), 4872401723.1244513000, 1e-5 \ No newline at end of file + assert.epsilon cosh(12), 81377.39571257407, 3e-11 + assert.epsilon cosh(22), 1792456423.065795780980053377, 1e-5 + assert.epsilon cosh(-10), 11013.23292010332313972137 + assert.epsilon cosh(-23), 4872401723.1244513000, 1e-5 \ No newline at end of file diff --git a/tests/tests/es6.math.expm1.ls b/tests/tests/es6.math.expm1.ls index 5d9637fa1fd6..f4ce0dfe88a1 100644 --- a/tests/tests/es6.math.expm1.ls +++ b/tests/tests/es6.math.expm1.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to subtracting 1 from the exponential function of x test 'Math.expm1' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {expm1} = Math assert.ok typeof! expm1 is \Function, 'is function' assert.strictEqual expm1.name, \expm1, 'name is "expm1"' @@ -13,5 +12,5 @@ test 'Math.expm1' (assert)-> assert.same expm1(-0), -0 assert.strictEqual expm1(Infinity), Infinity assert.strictEqual expm1(-Infinity), -1 - assert.ok epsilon expm1(10), 22025.465794806718, - assert.ok epsilon expm1(-10), -0.9999546000702375 \ No newline at end of file + assert.epsilon expm1(10), 22025.465794806718, + assert.epsilon expm1(-10), -0.9999546000702375 \ No newline at end of file diff --git a/tests/tests/es6.math.hypot.ls b/tests/tests/es6.math.hypot.ls index 2683b5fe53c0..91b949d6a6d0 100644 --- a/tests/tests/es6.math.hypot.ls +++ b/tests/tests/es6.math.hypot.ls @@ -2,7 +2,6 @@ module \ES6 # Math.hypot returns an implementation-dependent approximation of the square root of the sum of squares of its arguments. test 'Math.hypot' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {hypot, sqrt} = Math assert.ok typeof! hypot is \Function, 'is function' assert.strictEqual hypot.name, \hypot, 'name is "hypot"' @@ -36,8 +35,8 @@ test 'Math.hypot' (assert)-> assert.strictEqual hypot(1 0 0), 1 assert.strictEqual hypot(2 3 4), sqrt(2 * 2 + 3 * 3 + 4 * 4) assert.strictEqual hypot(2 3 4 5), sqrt(2 * 2 + 3 * 3 + 4 * 4 + 5 * 5) - assert.ok epsilon hypot(66 66), 93.33809511662427 - assert.ok epsilon hypot(0.1 100), 100.0000499999875 + assert.epsilon hypot(66 66), 93.33809511662427 + assert.epsilon hypot(0.1 100), 100.0000499999875 assert.strictEqual hypot(1e+300, 1e+300), 1.4142135623730952e+300 assert.strictEqual Math.floor(hypot(1e-300, 1e-300) * 1e308), 141421356 assert.strictEqual hypot(1e+300, 1e+300, 2, 3), 1.4142135623730952e+300 diff --git a/tests/tests/es6.math.log10.ls b/tests/tests/es6.math.log10.ls index 0db2ed441ee4..4aed5da28d15 100644 --- a/tests/tests/es6.math.log10.ls +++ b/tests/tests/es6.math.log10.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the base 10 logarithm of x. test 'Math.log10' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {log10} = Math assert.ok typeof! log10 is \Function, 'is function' assert.strictEqual log10.name, \log10, 'name is "log10"' @@ -15,8 +14,8 @@ test 'Math.log10' (assert)-> assert.same log10(-0), -Infinity assert.same log10(1), 0 assert.same log10(Infinity), Infinity - assert.ok epsilon log10(0.1), -1 # O_o - assert.ok epsilon log10(0.5), -0.3010299956639812 - assert.ok epsilon log10(1.5), 0.17609125905568124 - assert.ok epsilon log10(5), 0.6989700043360189 - assert.ok epsilon log10(50), 1.6989700043360187 \ No newline at end of file + assert.epsilon log10(0.1), -1 # O_o + assert.epsilon log10(0.5), -0.3010299956639812 + assert.epsilon log10(1.5), 0.17609125905568124 + assert.epsilon log10(5), 0.6989700043360189 + assert.epsilon log10(50), 1.6989700043360187 \ No newline at end of file diff --git a/tests/tests/es6.math.log1p.ls b/tests/tests/es6.math.log1p.ls index eebd142dfa23..5f523f00b33f 100644 --- a/tests/tests/es6.math.log1p.ls +++ b/tests/tests/es6.math.log1p.ls @@ -3,7 +3,6 @@ module \ES6 # Returns an implementation-dependent approximation to the natural logarithm of 1 + x. # The result is computed in a way that is accurate even when the value of x is close to zero. test 'Math.log1p' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {log1p} = Math assert.ok typeof! log1p is \Function, 'is function' assert.strictEqual log1p.name, \log1p, 'name is "log1p"' @@ -16,5 +15,5 @@ test 'Math.log1p' (assert)-> assert.same log1p(0), 0 assert.same log1p(-0), -0 assert.same log1p(Infinity), Infinity - assert.ok epsilon log1p(5), 1.791759469228055 - assert.ok epsilon log1p(50), 3.9318256327243257 \ No newline at end of file + assert.epsilon log1p(5), 1.791759469228055 + assert.epsilon log1p(50), 3.9318256327243257 \ No newline at end of file diff --git a/tests/tests/es6.math.log2.ls b/tests/tests/es6.math.log2.ls index 08c502e3c312..b8a8c975f82d 100644 --- a/tests/tests/es6.math.log2.ls +++ b/tests/tests/es6.math.log2.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the base 2 logarithm of x. test 'Math.log2' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {log2} = Math assert.ok typeof! log2 is \Function, 'is function' assert.strictEqual log2.name, \log2, 'name is "log2"' @@ -17,4 +16,4 @@ test 'Math.log2' (assert)-> assert.same log2(Infinity), Infinity assert.same log2(0.5), -1 assert.same log2(32), 5 - assert.ok epsilon log2(5), 2.321928094887362 \ No newline at end of file + assert.epsilon log2(5), 2.321928094887362 \ No newline at end of file diff --git a/tests/tests/es6.math.sinh.ls b/tests/tests/es6.math.sinh.ls index 41a867999a12..1f13635be908 100644 --- a/tests/tests/es6.math.sinh.ls +++ b/tests/tests/es6.math.sinh.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the hyperbolic sine of x. test 'Math.sinh' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {sinh} = Math assert.ok typeof! sinh is \Function, 'is function' assert.strictEqual sinh.name, \sinh, 'name is "sinh"' @@ -13,6 +12,6 @@ test 'Math.sinh' (assert)-> assert.same sinh(-0), -0 assert.strictEqual sinh(Infinity), Infinity assert.strictEqual sinh(-Infinity), -Infinity - assert.ok epsilon sinh(-5), -74.20321057778875 - assert.ok epsilon sinh(2), 3.6268604078470186 + assert.epsilon sinh(-5), -74.20321057778875 + assert.epsilon sinh(2), 3.6268604078470186 assert.strictEqual sinh(-2e-17), -2e-17 \ No newline at end of file diff --git a/tests/tests/es6.math.tanh.ls b/tests/tests/es6.math.tanh.ls index d3dd42d8894e..ed8017e9c8b1 100644 --- a/tests/tests/es6.math.tanh.ls +++ b/tests/tests/es6.math.tanh.ls @@ -2,7 +2,6 @@ module \ES6 # Returns an implementation-dependent approximation to the hyperbolic tangent of x. test 'Math.tanh' (assert)-> - epsilon = (a, b, E)-> Math.abs(a - b) <= if E? => E else 1e-11 {tanh} = Math assert.ok typeof! tanh is \Function, 'is function' assert.strictEqual tanh.name, \tanh, 'name is "tanh"' @@ -13,5 +12,5 @@ test 'Math.tanh' (assert)-> assert.same tanh(-0), -0 assert.strictEqual tanh(Infinity), 1 assert.strictEqual tanh(90), 1 - assert.ok epsilon tanh(10), 0.9999999958776927 + assert.epsilon tanh(10), 0.9999999958776927 #assert.strictEqual tanh(710), 1 #buggy v8 implementation \ No newline at end of file