From 236369b4596f800a990c452aab05173b6448d91d Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sun, 11 Aug 2024 16:31:38 +0530 Subject: [PATCH 1/2] test: revert to previous tolerance in test.js --- .../@stdlib/math/base/special/factorialln/test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/factorialln/test/test.js b/lib/node_modules/@stdlib/math/base/special/factorialln/test/test.js index 16d87698e076..b0419cc020d4 100644 --- a/lib/node_modules/@stdlib/math/base/special/factorialln/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/factorialln/test/test.js @@ -143,7 +143,7 @@ tape( 'the function evaluates the natural logarithm of the factorial of `x` (med t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { delta = abs( y - expected[i] ); - tol = 1.5 * EPS * abs( expected[i] ); + tol = EPS * abs( expected[i] ); t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); } } From 70a9ad06b6d1bfa79adbe3b6cf06aecdcabfad6b Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sun, 11 Aug 2024 16:33:12 +0530 Subject: [PATCH 2/2] docs: add comment in test.native.js --- .../@stdlib/math/base/special/factorialln/test/test.native.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/node_modules/@stdlib/math/base/special/factorialln/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/factorialln/test/test.native.js index 0400fd492d1e..289795626a2d 100644 --- a/lib/node_modules/@stdlib/math/base/special/factorialln/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/factorialln/test/test.native.js @@ -152,6 +152,8 @@ tape( 'the function evaluates the natural logarithm of the factorial of `x` (med t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { delta = abs( y - expected[i] ); + + // NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2774#discussion_r1712904184 tol = 1.5 * EPS * abs( expected[i] ); t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); }