From a0b880a586a1c2e75e8f682c1d557251089a0ca1 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 27 Jul 2026 09:21:27 +0000 Subject: [PATCH] test: migrate `math/base/special/logaddexp` to ULP-based testing Resolves a part of #11352. Migrates the fixture-loop assertions in test.js and test.native.js from relative-tolerance (EPS-based) checks to exact-equality assertions. The JavaScript implementation matches the reference fixture values (1000 cases) exactly (0 ULP difference in every case), so per the precedent established for math/base/special/sqrt (#12764), plain t.strictEqual() is used instead of isAlmostSameValue(), and the now-unused EPS/abs/ delta/tol machinery is removed. --- .../@stdlib/math/base/special/logaddexp/test/test.js | 12 +----------- .../math/base/special/logaddexp/test/test.native.js | 12 +----------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/logaddexp/test/test.js b/lib/node_modules/@stdlib/math/base/special/logaddexp/test/test.js index 6f47efeb9ae6..2103e1a75fb9 100644 --- a/lib/node_modules/@stdlib/math/base/special/logaddexp/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/logaddexp/test/test.js @@ -22,10 +22,8 @@ var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var abs = require( '@stdlib/math/base/special/abs' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var randu = require( '@stdlib/random/base/randu' ); var logaddexp = require( './../lib' ); @@ -103,8 +101,6 @@ tape( 'the function returns `-infinity` if both arguments are `-infinity`', func tape( 'the function accurately computes the natural logarithm of exp(x) + exp(y)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var v; @@ -115,13 +111,7 @@ tape( 'the function accurately computes the natural logarithm of exp(x) + exp(y) expected = data.expected; for ( i = 0; i < expected.length; i++ ) { v = logaddexp( x[ i ], y[ i ] ); - if ( v === expected[ i ] ) { - t.strictEqual( v, expected[ i ], 'returns expected value when provided '+x[ i ]+' and '+y[ i ] ); - } else { - delta = abs( expected[ i ] - v ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. actual: '+v+'. expected: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( v, expected[ i ], 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/logaddexp/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/logaddexp/test/test.native.js index 91c1ae972f4d..e78db18776c1 100644 --- a/lib/node_modules/@stdlib/math/base/special/logaddexp/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/logaddexp/test/test.native.js @@ -27,8 +27,6 @@ var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); var randu = require( '@stdlib/random/base/randu' ); var tryRequire = require( '@stdlib/utils/try-require' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); // FIXTURES // @@ -112,8 +110,6 @@ tape( 'the function returns `-infinity` if both arguments are `-infinity`', opts tape( 'the function accurately computes the natural logarithm of exp(x) + exp(y)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var v; @@ -124,13 +120,7 @@ tape( 'the function accurately computes the natural logarithm of exp(x) + exp(y) expected = data.expected; for ( i = 0; i < expected.length; i++ ) { v = logaddexp( x[ i ], y[ i ] ); - if ( v === expected[ i ] ) { - t.strictEqual( v, expected[ i ], 'returns expected value when provided '+x[ i ]+' and '+y[ i ] ); - } else { - delta = abs( expected[ i ] - v ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. actual: '+v+'. expected: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( v, expected[ i ], 'returns expected value' ); } t.end(); });