From 817bce18c24efc8bf5f4e97f73a1009b6c32c672 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Sat, 12 Sep 2026 14:21:52 +0000 Subject: [PATCH 1/6] test: migrate `blas/base/wasm/cscal` to ULP-based assertions Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_0195oEUtRFEWsJm5UfEMjkqG --- .../blas/base/wasm/cscal/test/test.main.js | 37 ++++++++-------- .../base/wasm/cscal/test/test.module.main.js | 32 +++++++------- .../wasm/cscal/test/test.module.ndarray.js | 42 +++++++++++-------- .../blas/base/wasm/cscal/test/test.ndarray.js | 42 +++++++++++-------- 4 files changed, 84 insertions(+), 69 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js index 0e5447d5e1af..b0eab371fc57 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js @@ -24,8 +24,7 @@ var tape = require( 'tape' ); var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); var Float32Array = require( '@stdlib/array/float32' ); -var EPS = require( '@stdlib/constants/float32/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var cscal = require( './../lib' ); @@ -38,22 +37,14 @@ var cscal = require( './../lib' ); * @param {Object} t - test object * @param {Collection} actual - actual values * @param {Collection} expected - expected values -* @param {number} rtol - relative tolerance +* @param {NonNegativeInteger} ulp - maximum allowed ULP difference */ -function isApprox( t, actual, expected, rtol ) { - var delta; - var tol; +function isApprox( t, actual, expected, ulp ) { var i; t.strictEqual( actual.length, expected.length, 'returns expected value' ); for ( i = 0; i < expected.length; i++ ) { - if ( actual[ i ] === expected[ i ] ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } else { - delta = abs( actual[ i ] - expected[ i ] ); - tol = rtol * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); } } @@ -74,9 +65,12 @@ tape( 'the `main` method has an arity of 4', function test( t ) { tape( 'the `main` method scales elements from `cx` by `ca`', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; + ULP = 1; + cx = new Complex64Array([ 0.3, // 1 0.1, // 1 @@ -102,7 +96,7 @@ tape( 'the `main` method scales elements from `cx` by `ca`', function test( t ) 0.14, // 4 0.08 // 4 ]); - isApprox( t, viewX, expected, 1.0 ); + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -110,9 +104,12 @@ tape( 'the `main` method scales elements from `cx` by `ca`', function test( t ) tape( 'the `main` method supports specifying a `cx` stride', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; + ULP = 1; + cx = new Complex64Array([ 0.1, // 1 0.1, // 1 @@ -146,7 +143,7 @@ tape( 'the `main` method supports specifying a `cx` stride', function test( t ) 7.0, 2.0 ]); - isApprox( t, viewX, expected, 1.0 ); + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -154,9 +151,12 @@ tape( 'the `main` method supports specifying a `cx` stride', function test( t ) tape( 'the `main` method supports specifying a negative `cx` stride', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; + ULP = 1; + cx = new Complex64Array([ 0.1, // 3 0.1, // 3 @@ -190,7 +190,7 @@ tape( 'the `main` method supports specifying a negative `cx` stride', function t 7.0, 2.0 ]); - isApprox( t, viewX, expected, 1.0 ); + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -235,8 +235,11 @@ tape( 'the `main` method supports view offsets', function test( t ) { var viewX; var cx0; var cx1; + var ULP; var ca; + ULP = 2; + // Initial arrays... cx0 = new Complex64Array([ 0.1, @@ -270,7 +273,7 @@ tape( 'the `main` method supports view offsets', function test( t ) { 2.0, 3.0 ]); - isApprox( t, viewX, expected, 1.0 ); + isApprox( t, viewX, expected, ULP ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js index 0682b2b8dcca..f4a7236fef69 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js @@ -26,8 +26,7 @@ var tape = require( 'tape' ); var Memory = require( '@stdlib/wasm/memory' ); var Complex64Array = require( '@stdlib/array/complex64' ); var Float32Array = require( '@stdlib/array/float32' ); -var EPS = require( '@stdlib/constants/float32/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var Module = require( './../lib' ).Module; @@ -40,22 +39,14 @@ var Module = require( './../lib' ).Module; * @param {Object} t - test object * @param {Collection} actual - actual values * @param {Collection} expected - expected values -* @param {number} rtol - relative tolerance +* @param {NonNegativeInteger} ulp - maximum allowed ULP difference */ -function isApprox( t, actual, expected, rtol ) { - var delta; - var tol; +function isApprox( t, actual, expected, ulp ) { var i; t.strictEqual( actual.length, expected.length, 'returns expected value' ); for ( i = 0; i < expected.length; i++ ) { - if ( actual[ i ] === expected[ i ] ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } else { - delta = abs( actual[ i ] - expected[ i ] ); - tol = rtol * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); } } @@ -88,6 +79,9 @@ tape( 'a module instance has a `main` method which scales elements from `cx` by var cxp; var mem; var mod; + var ULP; + + ULP = 0; mem = new Memory({ 'initial': 1 @@ -108,7 +102,7 @@ tape( 'a module instance has a `main` method which scales elements from `cx` by actualX = new Complex64Array( 3 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, 1.0 ); + isApprox( t, viewX, cxe, ULP ); t.end(); }); @@ -122,8 +116,11 @@ tape( 'a module instance has a `main` method which supports specifying a `cx` st var cxp; var mem; var mod; + var ULP; var cx; + ULP = 1; + mem = new Memory({ 'initial': 1 }); @@ -172,7 +169,7 @@ tape( 'a module instance has a `main` method which supports specifying a `cx` st actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, 1.0 ); + isApprox( t, viewX, cxe, ULP ); t.end(); }); @@ -186,8 +183,11 @@ tape( 'a module instance has a `main` method which supports specifying a negativ var cxp; var mem; var mod; + var ULP; var cx; + ULP = 1; + mem = new Memory({ 'initial': 1 }); @@ -236,7 +236,7 @@ tape( 'a module instance has a `main` method which supports specifying a negativ actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, 1.0 ); + isApprox( t, viewX, cxe, ULP ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js index 3630cf851911..13b50768947f 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js @@ -26,8 +26,7 @@ var tape = require( 'tape' ); var Memory = require( '@stdlib/wasm/memory' ); var Complex64Array = require( '@stdlib/array/complex64' ); var Float32Array = require( '@stdlib/array/float32' ); -var EPS = require( '@stdlib/constants/float32/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var Module = require( './../lib' ).Module; @@ -40,22 +39,14 @@ var Module = require( './../lib' ).Module; * @param {Object} t - test object * @param {Collection} actual - actual values * @param {Collection} expected - expected values -* @param {number} rtol - relative tolerance +* @param {NonNegativeInteger} ulp - maximum allowed ULP difference */ -function isApprox( t, actual, expected, rtol ) { - var delta; - var tol; +function isApprox( t, actual, expected, ulp ) { var i; t.strictEqual( actual.length, expected.length, 'returns expected value' ); for ( i = 0; i < expected.length; i++ ) { - if ( actual[ i ] === expected[ i ] ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } else { - delta = abs( actual[ i ] - expected[ i ] ); - tol = rtol * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); } } @@ -88,6 +79,9 @@ tape( 'a module instance has an `ndarray` method which scales elements from `cx` var cxp; var mem; var mod; + var ULP; + + ULP = 0; mem = new Memory({ 'initial': 1 @@ -108,7 +102,7 @@ tape( 'a module instance has an `ndarray` method which scales elements from `cx` actualX = new Complex64Array( 3 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, 1.0 ); + isApprox( t, viewX, cxe, ULP ); t.end(); }); @@ -122,8 +116,11 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` stride', var cxp; var mem; var mod; + var ULP; var cx; + ULP = 1; + mem = new Memory({ 'initial': 1 }); @@ -172,7 +169,7 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` stride', actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, 1.0 ); + isApprox( t, viewX, cxe, ULP ); t.end(); }); @@ -186,8 +183,11 @@ tape( 'a module instance has an `ndarray` method which supports a negative `cx` var cxp; var mem; var mod; + var ULP; var cx; + ULP = 1; + mem = new Memory({ 'initial': 1 }); @@ -236,7 +236,7 @@ tape( 'a module instance has an `ndarray` method which supports a negative `cx` actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, 1.0 ); + isApprox( t, viewX, cxe, ULP ); t.end(); }); @@ -250,8 +250,11 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` offset', var cxp; var mem; var mod; + var ULP; var cx; + ULP = 1; + mem = new Memory({ 'initial': 1 }); @@ -300,7 +303,7 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` offset', actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, 1.0 ); + isApprox( t, viewX, cxe, ULP ); t.end(); }); @@ -367,8 +370,11 @@ tape( 'a module instance has an `ndarray` method which supports complex access p var cxp; var mem; var mod; + var ULP; var cx; + ULP = 1; + mem = new Memory({ 'initial': 1 }); @@ -417,7 +423,7 @@ tape( 'a module instance has an `ndarray` method which supports complex access p actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, 1.0 ); + isApprox( t, viewX, cxe, ULP ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js index 23dd569f8be9..6639ab3b0648 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js @@ -24,8 +24,7 @@ var tape = require( 'tape' ); var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); var Float32Array = require( '@stdlib/array/float32' ); -var EPS = require( '@stdlib/constants/float32/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var cscal = require( './../lib' ); @@ -38,22 +37,14 @@ var cscal = require( './../lib' ); * @param {Object} t - test object * @param {Collection} actual - actual values * @param {Collection} expected - expected values -* @param {number} rtol - relative tolerance +* @param {NonNegativeInteger} ulp - maximum allowed ULP difference */ -function isApprox( t, actual, expected, rtol ) { - var delta; - var tol; +function isApprox( t, actual, expected, ulp ) { var i; t.strictEqual( actual.length, expected.length, 'returns expected value' ); for ( i = 0; i < expected.length; i++ ) { - if ( actual[ i ] === expected[ i ] ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } else { - delta = abs( actual[ i ] - expected[ i ] ); - tol = rtol * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); } } @@ -74,9 +65,12 @@ tape( 'the `ndarray` method has an arity of 5', function test( t ) { tape( 'the `ndarray` method scales elements from `cx` by `ca`', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; + ULP = 1; + cx = new Complex64Array([ 0.3, // 1 0.1, // 1 @@ -110,7 +104,7 @@ tape( 'the `ndarray` method scales elements from `cx` by `ca`', function test( t 2.0, 3.0 ]); - isApprox( t, viewX, expected, 1.0 ); + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -118,9 +112,12 @@ tape( 'the `ndarray` method scales elements from `cx` by `ca`', function test( t tape( 'the `ndarray` method supports specifying a `cx` stride', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; + ULP = 1; + cx = new Complex64Array([ 0.1, // 1 0.1, // 1 @@ -154,7 +151,7 @@ tape( 'the `ndarray` method supports specifying a `cx` stride', function test( t 7.0, 2.0 ]); - isApprox( t, viewX, expected, 1.0 ); + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -162,9 +159,12 @@ tape( 'the `ndarray` method supports specifying a `cx` stride', function test( t tape( 'the `ndarray` method supports specifying a negative `cx` stride', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; + ULP = 1; + cx = new Complex64Array([ 0.1, // 3 0.1, // 3 @@ -198,7 +198,7 @@ tape( 'the `ndarray` method supports specifying a negative `cx` stride', functio 7.0, 2.0 ]); - isApprox( t, viewX, expected, 1.0 ); + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -206,9 +206,12 @@ tape( 'the `ndarray` method supports specifying a negative `cx` stride', functio tape( 'the `ndarray` method supports a `cx` offset', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; + ULP = 5; + cx = new Complex64Array([ 0.1, 0.1, @@ -242,7 +245,7 @@ tape( 'the `ndarray` method supports a `cx` offset', function test( t ) { 4.2, // 3 -4.1 // 3 ]); - isApprox( t, viewX, expected, 5.0 ); + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -285,9 +288,12 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the `ndarray` met tape( 'the `ndarray` method supports complex access patterns', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; + ULP = 5; + cx = new Complex64Array([ 0.1, 0.1, @@ -325,7 +331,7 @@ tape( 'the `ndarray` method supports complex access patterns', function test( t 2.9, // 2 -0.2 // 2 ]); - isApprox( t, viewX, expected, 5.0 ); + isApprox( t, viewX, expected, ULP ); t.end(); }); From 792b892e4a1149d632f9776f1dd7ee82db849cef Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Mon, 21 Sep 2026 23:25:55 -0500 Subject: [PATCH 2/6] refactor: inline ULP values in test assertions Remove the isApprox helper function and inline ULP values directly at each isAlmostSameValuef call site per review feedback. Co-Authored-By: Claude Opus 5 (1M context) --- .../blas/base/wasm/cscal/test/test.main.js | 57 ++++++---------- .../base/wasm/cscal/test/test.module.main.js | 48 +++++--------- .../wasm/cscal/test/test.module.ndarray.js | 66 +++++++------------ .../blas/base/wasm/cscal/test/test.ndarray.js | 66 +++++++------------ 4 files changed, 85 insertions(+), 152 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js index b0eab371fc57..ebae6028f382 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js @@ -28,27 +28,6 @@ var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost- var cscal = require( './../lib' ); -// FUNCTIONS // - -/** -* Tests for element-wise approximate equality. -* -* @private -* @param {Object} t - test object -* @param {Collection} actual - actual values -* @param {Collection} expected - expected values -* @param {NonNegativeInteger} ulp - maximum allowed ULP difference -*/ -function isApprox( t, actual, expected, ulp ) { - var i; - - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); - } -} - - // TESTS // tape( 'main export is an object', function test( t ) { @@ -65,11 +44,9 @@ tape( 'the `main` method has an arity of 4', function test( t ) { tape( 'the `main` method scales elements from `cx` by `ca`', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - - ULP = 1; + var i; cx = new Complex64Array([ 0.3, // 1 @@ -96,7 +73,10 @@ tape( 'the `main` method scales elements from `cx` by `ca`', function test( t ) 0.14, // 4 0.08 // 4 ]); - isApprox( t, viewX, expected, ULP ); + t.strictEqual( viewX.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 1 ), true, 'returns expected value' ); + } t.end(); }); @@ -104,11 +84,9 @@ tape( 'the `main` method scales elements from `cx` by `ca`', function test( t ) tape( 'the `main` method supports specifying a `cx` stride', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - - ULP = 1; + var i; cx = new Complex64Array([ 0.1, // 1 @@ -143,7 +121,10 @@ tape( 'the `main` method supports specifying a `cx` stride', function test( t ) 7.0, 2.0 ]); - isApprox( t, viewX, expected, ULP ); + t.strictEqual( viewX.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 1 ), true, 'returns expected value' ); + } t.end(); }); @@ -151,11 +132,9 @@ tape( 'the `main` method supports specifying a `cx` stride', function test( t ) tape( 'the `main` method supports specifying a negative `cx` stride', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - - ULP = 1; + var i; cx = new Complex64Array([ 0.1, // 3 @@ -190,7 +169,10 @@ tape( 'the `main` method supports specifying a negative `cx` stride', function t 7.0, 2.0 ]); - isApprox( t, viewX, expected, ULP ); + t.strictEqual( viewX.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 1 ), true, 'returns expected value' ); + } t.end(); }); @@ -235,10 +217,8 @@ tape( 'the `main` method supports view offsets', function test( t ) { var viewX; var cx0; var cx1; - var ULP; var ca; - - ULP = 2; + var i; // Initial arrays... cx0 = new Complex64Array([ @@ -273,7 +253,10 @@ tape( 'the `main` method supports view offsets', function test( t ) { 2.0, 3.0 ]); - isApprox( t, viewX, expected, ULP ); + t.strictEqual( viewX.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 2 ), true, 'returns expected value' ); + } t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js index f4a7236fef69..4a240e699f20 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js @@ -30,27 +30,6 @@ var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost- var Module = require( './../lib' ).Module; -// FUNCTIONS // - -/** -* Tests for element-wise approximate equality. -* -* @private -* @param {Object} t - test object -* @param {Collection} actual - actual values -* @param {Collection} expected - expected values -* @param {NonNegativeInteger} ulp - maximum allowed ULP difference -*/ -function isApprox( t, actual, expected, ulp ) { - var i; - - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); - } -} - - // TESTS // tape( 'main export is a function', function test( t ) { @@ -79,9 +58,7 @@ tape( 'a module instance has a `main` method which scales elements from `cx` by var cxp; var mem; var mod; - var ULP; - - ULP = 0; + var i; mem = new Memory({ 'initial': 1 @@ -102,7 +79,10 @@ tape( 'a module instance has a `main` method which scales elements from `cx` by actualX = new Complex64Array( 3 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); + for ( i = 0; i < cxe.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 0 ), true, 'returns expected value' ); + } t.end(); }); @@ -116,10 +96,8 @@ tape( 'a module instance has a `main` method which supports specifying a `cx` st var cxp; var mem; var mod; - var ULP; var cx; - - ULP = 1; + var i; mem = new Memory({ 'initial': 1 @@ -169,7 +147,10 @@ tape( 'a module instance has a `main` method which supports specifying a `cx` st actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); + for ( i = 0; i < cxe.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 1 ), true, 'returns expected value' ); + } t.end(); }); @@ -183,10 +164,8 @@ tape( 'a module instance has a `main` method which supports specifying a negativ var cxp; var mem; var mod; - var ULP; var cx; - - ULP = 1; + var i; mem = new Memory({ 'initial': 1 @@ -236,7 +215,10 @@ tape( 'a module instance has a `main` method which supports specifying a negativ actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); + for ( i = 0; i < cxe.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 1 ), true, 'returns expected value' ); + } t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js index 13b50768947f..c197d80c3116 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js @@ -30,27 +30,6 @@ var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost- var Module = require( './../lib' ).Module; -// FUNCTIONS // - -/** -* Tests for element-wise approximate equality. -* -* @private -* @param {Object} t - test object -* @param {Collection} actual - actual values -* @param {Collection} expected - expected values -* @param {NonNegativeInteger} ulp - maximum allowed ULP difference -*/ -function isApprox( t, actual, expected, ulp ) { - var i; - - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); - } -} - - // TESTS // tape( 'main export is a function', function test( t ) { @@ -79,9 +58,7 @@ tape( 'a module instance has an `ndarray` method which scales elements from `cx` var cxp; var mem; var mod; - var ULP; - - ULP = 0; + var i; mem = new Memory({ 'initial': 1 @@ -102,7 +79,10 @@ tape( 'a module instance has an `ndarray` method which scales elements from `cx` actualX = new Complex64Array( 3 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); + for ( i = 0; i < cxe.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 0 ), true, 'returns expected value' ); + } t.end(); }); @@ -116,10 +96,8 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` stride', var cxp; var mem; var mod; - var ULP; var cx; - - ULP = 1; + var i; mem = new Memory({ 'initial': 1 @@ -169,7 +147,10 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` stride', actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); + for ( i = 0; i < cxe.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 1 ), true, 'returns expected value' ); + } t.end(); }); @@ -183,10 +164,8 @@ tape( 'a module instance has an `ndarray` method which supports a negative `cx` var cxp; var mem; var mod; - var ULP; var cx; - - ULP = 1; + var i; mem = new Memory({ 'initial': 1 @@ -236,7 +215,10 @@ tape( 'a module instance has an `ndarray` method which supports a negative `cx` actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); + for ( i = 0; i < cxe.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 1 ), true, 'returns expected value' ); + } t.end(); }); @@ -250,10 +232,8 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` offset', var cxp; var mem; var mod; - var ULP; var cx; - - ULP = 1; + var i; mem = new Memory({ 'initial': 1 @@ -303,7 +283,10 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` offset', actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); + for ( i = 0; i < cxe.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 1 ), true, 'returns expected value' ); + } t.end(); }); @@ -370,10 +353,8 @@ tape( 'a module instance has an `ndarray` method which supports complex access p var cxp; var mem; var mod; - var ULP; var cx; - - ULP = 1; + var i; mem = new Memory({ 'initial': 1 @@ -423,7 +404,10 @@ tape( 'a module instance has an `ndarray` method which supports complex access p actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); + for ( i = 0; i < cxe.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 1 ), true, 'returns expected value' ); + } t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js index 6639ab3b0648..a6ae0442d51f 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js @@ -28,27 +28,6 @@ var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost- var cscal = require( './../lib' ); -// FUNCTIONS // - -/** -* Tests for element-wise approximate equality. -* -* @private -* @param {Object} t - test object -* @param {Collection} actual - actual values -* @param {Collection} expected - expected values -* @param {NonNegativeInteger} ulp - maximum allowed ULP difference -*/ -function isApprox( t, actual, expected, ulp ) { - var i; - - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); - } -} - - // TESTS // tape( 'main export is an object', function test( t ) { @@ -65,11 +44,9 @@ tape( 'the `ndarray` method has an arity of 5', function test( t ) { tape( 'the `ndarray` method scales elements from `cx` by `ca`', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - - ULP = 1; + var i; cx = new Complex64Array([ 0.3, // 1 @@ -104,7 +81,10 @@ tape( 'the `ndarray` method scales elements from `cx` by `ca`', function test( t 2.0, 3.0 ]); - isApprox( t, viewX, expected, ULP ); + t.strictEqual( viewX.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 1 ), true, 'returns expected value' ); + } t.end(); }); @@ -112,11 +92,9 @@ tape( 'the `ndarray` method scales elements from `cx` by `ca`', function test( t tape( 'the `ndarray` method supports specifying a `cx` stride', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - - ULP = 1; + var i; cx = new Complex64Array([ 0.1, // 1 @@ -151,7 +129,10 @@ tape( 'the `ndarray` method supports specifying a `cx` stride', function test( t 7.0, 2.0 ]); - isApprox( t, viewX, expected, ULP ); + t.strictEqual( viewX.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 1 ), true, 'returns expected value' ); + } t.end(); }); @@ -159,11 +140,9 @@ tape( 'the `ndarray` method supports specifying a `cx` stride', function test( t tape( 'the `ndarray` method supports specifying a negative `cx` stride', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - - ULP = 1; + var i; cx = new Complex64Array([ 0.1, // 3 @@ -198,7 +177,10 @@ tape( 'the `ndarray` method supports specifying a negative `cx` stride', functio 7.0, 2.0 ]); - isApprox( t, viewX, expected, ULP ); + t.strictEqual( viewX.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 1 ), true, 'returns expected value' ); + } t.end(); }); @@ -206,11 +188,9 @@ tape( 'the `ndarray` method supports specifying a negative `cx` stride', functio tape( 'the `ndarray` method supports a `cx` offset', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - - ULP = 5; + var i; cx = new Complex64Array([ 0.1, @@ -245,7 +225,10 @@ tape( 'the `ndarray` method supports a `cx` offset', function test( t ) { 4.2, // 3 -4.1 // 3 ]); - isApprox( t, viewX, expected, ULP ); + t.strictEqual( viewX.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 5 ), true, 'returns expected value' ); + } t.end(); }); @@ -288,11 +271,9 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the `ndarray` met tape( 'the `ndarray` method supports complex access patterns', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - - ULP = 5; + var i; cx = new Complex64Array([ 0.1, @@ -331,7 +312,10 @@ tape( 'the `ndarray` method supports complex access patterns', function test( t 2.9, // 2 -0.2 // 2 ]); - isApprox( t, viewX, expected, ULP ); + t.strictEqual( viewX.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 5 ), true, 'returns expected value' ); + } t.end(); }); From 550d71b74a3164ae8c46b9d0acf0c4cae4802244 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Mon, 21 Sep 2026 23:27:01 -0500 Subject: [PATCH 3/6] refactor: inline ULP values in crot test assertions - Replace EPS/absf-based relative tolerance with isAlmostSameValuef ULP-based assertions - Inline measured ULP values at each isApprox call site (viewX and viewY get different values) - Remove unused EPS, absf imports and delta/tol variables Co-Authored-By: Claude Opus 5 (1M context) --- .../lapack/base/crot/test/test.crot.js | 49 ++++++++----------- .../lapack/base/crot/test/test.ndarray.js | 45 +++++++---------- 2 files changed, 38 insertions(+), 56 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/crot/test/test.crot.js b/lib/node_modules/@stdlib/lapack/base/crot/test/test.crot.js index 3fb14fdf4626..9af4071af793 100644 --- a/lib/node_modules/@stdlib/lapack/base/crot/test/test.crot.js +++ b/lib/node_modules/@stdlib/lapack/base/crot/test/test.crot.js @@ -24,8 +24,7 @@ var tape = require( 'tape' ); var Float32Array = require( '@stdlib/array/float32' ); var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var EPS = require( '@stdlib/constants/float32/eps' ); -var absf = require( '@stdlib/math/base/special/absf' ); +var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var crot = require( './../lib/crot.js' ); @@ -38,22 +37,14 @@ var crot = require( './../lib/crot.js' ); * @param {Object} t - test object * @param {Collection} actual - actual values * @param {Collection} expected - expected values -* @param {number} rtol - relative tolerance +* @param {NonNegativeInteger} ulp - maximum allowed ULP difference */ -function isApprox( t, actual, expected, rtol ) { - var delta; - var tol; +function isApprox( t, actual, expected, ulp ) { var i; t.strictEqual( actual.length, expected.length, 'returns expected value' ); for ( i = 0; i < expected.length; i++ ) { - if ( actual[ i ] === expected[ i ] ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } else { - delta = absf( actual[ i ] - expected[ i ] ); - tol = rtol * EPS * absf( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); } } @@ -130,8 +121,8 @@ tape( 'the function applies a plane rotation', function test( t ) { ]); out = crot( cx.length, cx, 1, cy, 1, 0.8, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 2.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 1 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); @@ -195,8 +186,8 @@ tape( 'the function applies a plane rotation', function test( t ) { ]); out = crot( cx.length, cx, 1, cy, 1, 1.25, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 2.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 0 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); @@ -260,8 +251,8 @@ tape( 'the function applies a plane rotation', function test( t ) { ]); out = crot( cx.length, cx, 1, cy, 1, 1.25, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 4.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 5 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); @@ -323,8 +314,8 @@ tape( 'the function supports an `x` stride', function test( t ) { ]); out = crot( 2, cx, 2, cy, 1, 0.8, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 4.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 5 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); @@ -386,8 +377,8 @@ tape( 'the function supports a `y` stride', function test( t ) { ]); out = crot( 2, cx, 1, cy, 2, 0.8, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 2.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 1 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); @@ -495,8 +486,8 @@ tape( 'the function supports negative strides', function test( t ) { ]); out = crot( 2, cx, -1, cy, -2, 0.8, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 2.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 1 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); @@ -558,8 +549,8 @@ tape( 'the function supports complex access patterns', function test( t ) { ]); out = crot( 2, cx, 2, cy, -1, 0.8, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 4.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 5 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); @@ -629,8 +620,8 @@ tape( 'the function supports view offsets', function test( t ) { ]); out = crot( 2, cx1, -2, cy1, 1, 0.8, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 4.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 5 ); t.strictEqual( out, cy1, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/lapack/base/crot/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/crot/test/test.ndarray.js index 35b67bd85266..de70e5104e4d 100644 --- a/lib/node_modules/@stdlib/lapack/base/crot/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/crot/test/test.ndarray.js @@ -24,8 +24,7 @@ var tape = require( 'tape' ); var Float32Array = require( '@stdlib/array/float32' ); var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var EPS = require( '@stdlib/constants/float32/eps' ); -var absf = require( '@stdlib/math/base/special/absf' ); +var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var crot = require( './../lib/ndarray.js' ); @@ -38,22 +37,14 @@ var crot = require( './../lib/ndarray.js' ); * @param {Object} t - test object * @param {Collection} actual - actual values * @param {Collection} expected - expected values -* @param {number} rtol - relative tolerance +* @param {NonNegativeInteger} ulp - maximum allowed ULP difference */ -function isApprox( t, actual, expected, rtol ) { - var delta; - var tol; +function isApprox( t, actual, expected, ulp ) { var i; t.strictEqual( actual.length, expected.length, 'returns expected value' ); for ( i = 0; i < expected.length; i++ ) { - if ( actual[ i ] === expected[ i ] ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } else { - delta = absf( actual[ i ] - expected[ i ] ); - tol = rtol * EPS * absf( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); } } @@ -129,8 +120,8 @@ tape( 'the function applies a plane rotation', function test( t ) { ]); out = crot( cx.length, cx, 1, 0, cy, 1, 0, 0.8, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 2.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 1 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); @@ -192,8 +183,8 @@ tape( 'the function supports an `x` stride', function test( t ) { ]); out = crot( 2, cx, 2, 0, cy, 1, 0, 0.8, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 2.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 1 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); @@ -255,8 +246,8 @@ tape( 'the function supports an `x` offset', function test( t ) { ]); out = crot( 3, cx, 1, 1, cy, 1, 0, 0.8, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 4.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 5 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); @@ -318,8 +309,8 @@ tape( 'the function supports a `y` stride', function test( t ) { ]); out = crot( 2, cx, 1, 0, cy, 2, 0, 0.8, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 2.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 1 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); @@ -381,8 +372,8 @@ tape( 'the function supports a `y` offset', function test( t ) { ]); out = crot( 2, cx, 2, 0, cy, -1, 1, 0.8, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 4.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 5 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); @@ -490,8 +481,8 @@ tape( 'the function supports negative strides', function test( t ) { ]); out = crot( 2, cx, -1, 1, cy, -2, 2, 0.8, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 2.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 1 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); @@ -553,8 +544,8 @@ tape( 'the function supports complex access patterns', function test( t ) { ]); out = crot( 2, cx, 2, 1, cy, 1, 2, 0.8, s ); - isApprox( t, viewX, cxe, 2.0 ); - isApprox( t, viewY, cye, 4.0 ); + isApprox( t, viewX, cxe, 0 ); + isApprox( t, viewY, cye, 5 ); t.strictEqual( out, cy, 'returns expected value' ); t.end(); }); From 62a2ff7aeaf68c116450ade27035d17ab508f574 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Tue, 22 Sep 2026 00:08:05 -0500 Subject: [PATCH 4/6] revert: restore isApprox helper in test files Co-Authored-By: Claude Opus 5 (1M context) --- .../blas/base/wasm/cscal/test/test.main.js | 57 ++++++++++------ .../base/wasm/cscal/test/test.module.main.js | 48 +++++++++----- .../wasm/cscal/test/test.module.ndarray.js | 66 ++++++++++++------- .../blas/base/wasm/cscal/test/test.ndarray.js | 66 ++++++++++++------- 4 files changed, 152 insertions(+), 85 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js index ebae6028f382..b0eab371fc57 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js @@ -28,6 +28,27 @@ var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost- var cscal = require( './../lib' ); +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {NonNegativeInteger} ulp - maximum allowed ULP difference +*/ +function isApprox( t, actual, expected, ulp ) { + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); + } +} + + // TESTS // tape( 'main export is an object', function test( t ) { @@ -44,9 +65,11 @@ tape( 'the `main` method has an arity of 4', function test( t ) { tape( 'the `main` method scales elements from `cx` by `ca`', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; - var i; + + ULP = 1; cx = new Complex64Array([ 0.3, // 1 @@ -73,10 +96,7 @@ tape( 'the `main` method scales elements from `cx` by `ca`', function test( t ) 0.14, // 4 0.08 // 4 ]); - t.strictEqual( viewX.length, expected.length, 'returns expected value' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 1 ), true, 'returns expected value' ); - } + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -84,9 +104,11 @@ tape( 'the `main` method scales elements from `cx` by `ca`', function test( t ) tape( 'the `main` method supports specifying a `cx` stride', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; - var i; + + ULP = 1; cx = new Complex64Array([ 0.1, // 1 @@ -121,10 +143,7 @@ tape( 'the `main` method supports specifying a `cx` stride', function test( t ) 7.0, 2.0 ]); - t.strictEqual( viewX.length, expected.length, 'returns expected value' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 1 ), true, 'returns expected value' ); - } + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -132,9 +151,11 @@ tape( 'the `main` method supports specifying a `cx` stride', function test( t ) tape( 'the `main` method supports specifying a negative `cx` stride', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; - var i; + + ULP = 1; cx = new Complex64Array([ 0.1, // 3 @@ -169,10 +190,7 @@ tape( 'the `main` method supports specifying a negative `cx` stride', function t 7.0, 2.0 ]); - t.strictEqual( viewX.length, expected.length, 'returns expected value' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 1 ), true, 'returns expected value' ); - } + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -217,8 +235,10 @@ tape( 'the `main` method supports view offsets', function test( t ) { var viewX; var cx0; var cx1; + var ULP; var ca; - var i; + + ULP = 2; // Initial arrays... cx0 = new Complex64Array([ @@ -253,10 +273,7 @@ tape( 'the `main` method supports view offsets', function test( t ) { 2.0, 3.0 ]); - t.strictEqual( viewX.length, expected.length, 'returns expected value' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 2 ), true, 'returns expected value' ); - } + isApprox( t, viewX, expected, ULP ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js index 4a240e699f20..f4a7236fef69 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js @@ -30,6 +30,27 @@ var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost- var Module = require( './../lib' ).Module; +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {NonNegativeInteger} ulp - maximum allowed ULP difference +*/ +function isApprox( t, actual, expected, ulp ) { + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); + } +} + + // TESTS // tape( 'main export is a function', function test( t ) { @@ -58,7 +79,9 @@ tape( 'a module instance has a `main` method which scales elements from `cx` by var cxp; var mem; var mod; - var i; + var ULP; + + ULP = 0; mem = new Memory({ 'initial': 1 @@ -79,10 +102,7 @@ tape( 'a module instance has a `main` method which scales elements from `cx` by actualX = new Complex64Array( 3 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); - for ( i = 0; i < cxe.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 0 ), true, 'returns expected value' ); - } + isApprox( t, viewX, cxe, ULP ); t.end(); }); @@ -96,8 +116,10 @@ tape( 'a module instance has a `main` method which supports specifying a `cx` st var cxp; var mem; var mod; + var ULP; var cx; - var i; + + ULP = 1; mem = new Memory({ 'initial': 1 @@ -147,10 +169,7 @@ tape( 'a module instance has a `main` method which supports specifying a `cx` st actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); - for ( i = 0; i < cxe.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 1 ), true, 'returns expected value' ); - } + isApprox( t, viewX, cxe, ULP ); t.end(); }); @@ -164,8 +183,10 @@ tape( 'a module instance has a `main` method which supports specifying a negativ var cxp; var mem; var mod; + var ULP; var cx; - var i; + + ULP = 1; mem = new Memory({ 'initial': 1 @@ -215,10 +236,7 @@ tape( 'a module instance has a `main` method which supports specifying a negativ actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); - for ( i = 0; i < cxe.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 1 ), true, 'returns expected value' ); - } + isApprox( t, viewX, cxe, ULP ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js index c197d80c3116..13b50768947f 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js @@ -30,6 +30,27 @@ var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost- var Module = require( './../lib' ).Module; +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {NonNegativeInteger} ulp - maximum allowed ULP difference +*/ +function isApprox( t, actual, expected, ulp ) { + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); + } +} + + // TESTS // tape( 'main export is a function', function test( t ) { @@ -58,7 +79,9 @@ tape( 'a module instance has an `ndarray` method which scales elements from `cx` var cxp; var mem; var mod; - var i; + var ULP; + + ULP = 0; mem = new Memory({ 'initial': 1 @@ -79,10 +102,7 @@ tape( 'a module instance has an `ndarray` method which scales elements from `cx` actualX = new Complex64Array( 3 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); - for ( i = 0; i < cxe.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 0 ), true, 'returns expected value' ); - } + isApprox( t, viewX, cxe, ULP ); t.end(); }); @@ -96,8 +116,10 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` stride', var cxp; var mem; var mod; + var ULP; var cx; - var i; + + ULP = 1; mem = new Memory({ 'initial': 1 @@ -147,10 +169,7 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` stride', actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); - for ( i = 0; i < cxe.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 1 ), true, 'returns expected value' ); - } + isApprox( t, viewX, cxe, ULP ); t.end(); }); @@ -164,8 +183,10 @@ tape( 'a module instance has an `ndarray` method which supports a negative `cx` var cxp; var mem; var mod; + var ULP; var cx; - var i; + + ULP = 1; mem = new Memory({ 'initial': 1 @@ -215,10 +236,7 @@ tape( 'a module instance has an `ndarray` method which supports a negative `cx` actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); - for ( i = 0; i < cxe.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 1 ), true, 'returns expected value' ); - } + isApprox( t, viewX, cxe, ULP ); t.end(); }); @@ -232,8 +250,10 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` offset', var cxp; var mem; var mod; + var ULP; var cx; - var i; + + ULP = 1; mem = new Memory({ 'initial': 1 @@ -283,10 +303,7 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` offset', actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); - for ( i = 0; i < cxe.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 1 ), true, 'returns expected value' ); - } + isApprox( t, viewX, cxe, ULP ); t.end(); }); @@ -353,8 +370,10 @@ tape( 'a module instance has an `ndarray` method which supports complex access p var cxp; var mem; var mod; + var ULP; var cx; - var i; + + ULP = 1; mem = new Memory({ 'initial': 1 @@ -404,10 +423,7 @@ tape( 'a module instance has an `ndarray` method which supports complex access p actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - t.strictEqual( viewX.length, cxe.length, 'returns expected value' ); - for ( i = 0; i < cxe.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], cxe[ i ], 1 ), true, 'returns expected value' ); - } + isApprox( t, viewX, cxe, ULP ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js index a6ae0442d51f..6639ab3b0648 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js @@ -28,6 +28,27 @@ var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost- var cscal = require( './../lib' ); +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {NonNegativeInteger} ulp - maximum allowed ULP difference +*/ +function isApprox( t, actual, expected, ulp ) { + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + t.strictEqual( isAlmostSameValuef( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); + } +} + + // TESTS // tape( 'main export is an object', function test( t ) { @@ -44,9 +65,11 @@ tape( 'the `ndarray` method has an arity of 5', function test( t ) { tape( 'the `ndarray` method scales elements from `cx` by `ca`', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; - var i; + + ULP = 1; cx = new Complex64Array([ 0.3, // 1 @@ -81,10 +104,7 @@ tape( 'the `ndarray` method scales elements from `cx` by `ca`', function test( t 2.0, 3.0 ]); - t.strictEqual( viewX.length, expected.length, 'returns expected value' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 1 ), true, 'returns expected value' ); - } + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -92,9 +112,11 @@ tape( 'the `ndarray` method scales elements from `cx` by `ca`', function test( t tape( 'the `ndarray` method supports specifying a `cx` stride', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; - var i; + + ULP = 1; cx = new Complex64Array([ 0.1, // 1 @@ -129,10 +151,7 @@ tape( 'the `ndarray` method supports specifying a `cx` stride', function test( t 7.0, 2.0 ]); - t.strictEqual( viewX.length, expected.length, 'returns expected value' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 1 ), true, 'returns expected value' ); - } + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -140,9 +159,11 @@ tape( 'the `ndarray` method supports specifying a `cx` stride', function test( t tape( 'the `ndarray` method supports specifying a negative `cx` stride', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; - var i; + + ULP = 1; cx = new Complex64Array([ 0.1, // 3 @@ -177,10 +198,7 @@ tape( 'the `ndarray` method supports specifying a negative `cx` stride', functio 7.0, 2.0 ]); - t.strictEqual( viewX.length, expected.length, 'returns expected value' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 1 ), true, 'returns expected value' ); - } + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -188,9 +206,11 @@ tape( 'the `ndarray` method supports specifying a negative `cx` stride', functio tape( 'the `ndarray` method supports a `cx` offset', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; - var i; + + ULP = 5; cx = new Complex64Array([ 0.1, @@ -225,10 +245,7 @@ tape( 'the `ndarray` method supports a `cx` offset', function test( t ) { 4.2, // 3 -4.1 // 3 ]); - t.strictEqual( viewX.length, expected.length, 'returns expected value' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 5 ), true, 'returns expected value' ); - } + isApprox( t, viewX, expected, ULP ); t.end(); }); @@ -271,9 +288,11 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the `ndarray` met tape( 'the `ndarray` method supports complex access patterns', function test( t ) { var expected; var viewX; + var ULP; var ca; var cx; - var i; + + ULP = 5; cx = new Complex64Array([ 0.1, @@ -312,10 +331,7 @@ tape( 'the `ndarray` method supports complex access patterns', function test( t 2.9, // 2 -0.2 // 2 ]); - t.strictEqual( viewX.length, expected.length, 'returns expected value' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isAlmostSameValuef( viewX[ i ], expected[ i ], 5 ), true, 'returns expected value' ); - } + isApprox( t, viewX, expected, ULP ); t.end(); }); From ffa34249260d87e433b9f92e7dbd92ed21f312c2 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Tue, 22 Sep 2026 00:10:35 -0500 Subject: [PATCH 5/6] style: inline ULP literal values in isApprox calls Co-Authored-By: Claude Opus 5 (1M context) --- .../blas/base/wasm/cscal/test/test.main.js | 16 ++++----------- .../base/wasm/cscal/test/test.module.main.js | 12 +++-------- .../wasm/cscal/test/test.module.ndarray.js | 20 +++++-------------- .../blas/base/wasm/cscal/test/test.ndarray.js | 20 +++++-------------- 4 files changed, 17 insertions(+), 51 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js index b0eab371fc57..30363c3bab5e 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js @@ -65,11 +65,9 @@ tape( 'the `main` method has an arity of 4', function test( t ) { tape( 'the `main` method scales elements from `cx` by `ca`', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - ULP = 1; cx = new Complex64Array([ 0.3, // 1 @@ -96,7 +94,7 @@ tape( 'the `main` method scales elements from `cx` by `ca`', function test( t ) 0.14, // 4 0.08 // 4 ]); - isApprox( t, viewX, expected, ULP ); + isApprox( t, viewX, expected, 1 ); t.end(); }); @@ -104,11 +102,9 @@ tape( 'the `main` method scales elements from `cx` by `ca`', function test( t ) tape( 'the `main` method supports specifying a `cx` stride', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - ULP = 1; cx = new Complex64Array([ 0.1, // 1 @@ -143,7 +139,7 @@ tape( 'the `main` method supports specifying a `cx` stride', function test( t ) 7.0, 2.0 ]); - isApprox( t, viewX, expected, ULP ); + isApprox( t, viewX, expected, 1 ); t.end(); }); @@ -151,11 +147,9 @@ tape( 'the `main` method supports specifying a `cx` stride', function test( t ) tape( 'the `main` method supports specifying a negative `cx` stride', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - ULP = 1; cx = new Complex64Array([ 0.1, // 3 @@ -190,7 +184,7 @@ tape( 'the `main` method supports specifying a negative `cx` stride', function t 7.0, 2.0 ]); - isApprox( t, viewX, expected, ULP ); + isApprox( t, viewX, expected, 1 ); t.end(); }); @@ -235,10 +229,8 @@ tape( 'the `main` method supports view offsets', function test( t ) { var viewX; var cx0; var cx1; - var ULP; var ca; - ULP = 2; // Initial arrays... cx0 = new Complex64Array([ @@ -273,7 +265,7 @@ tape( 'the `main` method supports view offsets', function test( t ) { 2.0, 3.0 ]); - isApprox( t, viewX, expected, ULP ); + isApprox( t, viewX, expected, 2 ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js index f4a7236fef69..01dfe6a30650 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js @@ -79,9 +79,7 @@ tape( 'a module instance has a `main` method which scales elements from `cx` by var cxp; var mem; var mod; - var ULP; - ULP = 0; mem = new Memory({ 'initial': 1 @@ -102,7 +100,7 @@ tape( 'a module instance has a `main` method which scales elements from `cx` by actualX = new Complex64Array( 3 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + isApprox( t, viewX, cxe, 0 ); t.end(); }); @@ -116,10 +114,8 @@ tape( 'a module instance has a `main` method which supports specifying a `cx` st var cxp; var mem; var mod; - var ULP; var cx; - ULP = 1; mem = new Memory({ 'initial': 1 @@ -169,7 +165,7 @@ tape( 'a module instance has a `main` method which supports specifying a `cx` st actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + isApprox( t, viewX, cxe, 1 ); t.end(); }); @@ -183,10 +179,8 @@ tape( 'a module instance has a `main` method which supports specifying a negativ var cxp; var mem; var mod; - var ULP; var cx; - ULP = 1; mem = new Memory({ 'initial': 1 @@ -236,7 +230,7 @@ tape( 'a module instance has a `main` method which supports specifying a negativ actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + isApprox( t, viewX, cxe, 1 ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js index 13b50768947f..3b5b7ab65ab6 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js @@ -79,9 +79,7 @@ tape( 'a module instance has an `ndarray` method which scales elements from `cx` var cxp; var mem; var mod; - var ULP; - ULP = 0; mem = new Memory({ 'initial': 1 @@ -102,7 +100,7 @@ tape( 'a module instance has an `ndarray` method which scales elements from `cx` actualX = new Complex64Array( 3 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + isApprox( t, viewX, cxe, 0 ); t.end(); }); @@ -116,10 +114,8 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` stride', var cxp; var mem; var mod; - var ULP; var cx; - ULP = 1; mem = new Memory({ 'initial': 1 @@ -169,7 +165,7 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` stride', actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + isApprox( t, viewX, cxe, 1 ); t.end(); }); @@ -183,10 +179,8 @@ tape( 'a module instance has an `ndarray` method which supports a negative `cx` var cxp; var mem; var mod; - var ULP; var cx; - ULP = 1; mem = new Memory({ 'initial': 1 @@ -236,7 +230,7 @@ tape( 'a module instance has an `ndarray` method which supports a negative `cx` actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + isApprox( t, viewX, cxe, 1 ); t.end(); }); @@ -250,10 +244,8 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` offset', var cxp; var mem; var mod; - var ULP; var cx; - ULP = 1; mem = new Memory({ 'initial': 1 @@ -303,7 +295,7 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` offset', actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + isApprox( t, viewX, cxe, 1 ); t.end(); }); @@ -370,10 +362,8 @@ tape( 'a module instance has an `ndarray` method which supports complex access p var cxp; var mem; var mod; - var ULP; var cx; - ULP = 1; mem = new Memory({ 'initial': 1 @@ -423,7 +413,7 @@ tape( 'a module instance has an `ndarray` method which supports complex access p actualX = new Complex64Array( 6 ); mod.read( cxp, actualX ); viewX = new Float32Array( actualX.buffer ); - isApprox( t, viewX, cxe, ULP ); + isApprox( t, viewX, cxe, 1 ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js index 6639ab3b0648..592470ccbc92 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js @@ -65,11 +65,9 @@ tape( 'the `ndarray` method has an arity of 5', function test( t ) { tape( 'the `ndarray` method scales elements from `cx` by `ca`', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - ULP = 1; cx = new Complex64Array([ 0.3, // 1 @@ -104,7 +102,7 @@ tape( 'the `ndarray` method scales elements from `cx` by `ca`', function test( t 2.0, 3.0 ]); - isApprox( t, viewX, expected, ULP ); + isApprox( t, viewX, expected, 1 ); t.end(); }); @@ -112,11 +110,9 @@ tape( 'the `ndarray` method scales elements from `cx` by `ca`', function test( t tape( 'the `ndarray` method supports specifying a `cx` stride', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - ULP = 1; cx = new Complex64Array([ 0.1, // 1 @@ -151,7 +147,7 @@ tape( 'the `ndarray` method supports specifying a `cx` stride', function test( t 7.0, 2.0 ]); - isApprox( t, viewX, expected, ULP ); + isApprox( t, viewX, expected, 1 ); t.end(); }); @@ -159,11 +155,9 @@ tape( 'the `ndarray` method supports specifying a `cx` stride', function test( t tape( 'the `ndarray` method supports specifying a negative `cx` stride', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - ULP = 1; cx = new Complex64Array([ 0.1, // 3 @@ -198,7 +192,7 @@ tape( 'the `ndarray` method supports specifying a negative `cx` stride', functio 7.0, 2.0 ]); - isApprox( t, viewX, expected, ULP ); + isApprox( t, viewX, expected, 1 ); t.end(); }); @@ -206,11 +200,9 @@ tape( 'the `ndarray` method supports specifying a negative `cx` stride', functio tape( 'the `ndarray` method supports a `cx` offset', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - ULP = 5; cx = new Complex64Array([ 0.1, @@ -245,7 +237,7 @@ tape( 'the `ndarray` method supports a `cx` offset', function test( t ) { 4.2, // 3 -4.1 // 3 ]); - isApprox( t, viewX, expected, ULP ); + isApprox( t, viewX, expected, 5 ); t.end(); }); @@ -288,11 +280,9 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the `ndarray` met tape( 'the `ndarray` method supports complex access patterns', function test( t ) { var expected; var viewX; - var ULP; var ca; var cx; - ULP = 5; cx = new Complex64Array([ 0.1, @@ -331,7 +321,7 @@ tape( 'the `ndarray` method supports complex access patterns', function test( t 2.9, // 2 -0.2 // 2 ]); - isApprox( t, viewX, expected, ULP ); + isApprox( t, viewX, expected, 5 ); t.end(); }); From 9e1baa39a74d3468d0ce02e86e1ff1e01df3697a Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Tue, 22 Sep 2026 00:18:13 -0500 Subject: [PATCH 6/6] style: fix extra blank lines in test files Co-Authored-By: Claude Opus 5 (1M context) --- .../@stdlib/blas/base/wasm/cscal/test/test.main.js | 4 ---- .../@stdlib/blas/base/wasm/cscal/test/test.module.main.js | 3 --- .../@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js | 5 ----- .../@stdlib/blas/base/wasm/cscal/test/test.ndarray.js | 5 ----- 4 files changed, 17 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js index 30363c3bab5e..6b3659d483c3 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.main.js @@ -68,7 +68,6 @@ tape( 'the `main` method scales elements from `cx` by `ca`', function test( t ) var ca; var cx; - cx = new Complex64Array([ 0.3, // 1 0.1, // 1 @@ -105,7 +104,6 @@ tape( 'the `main` method supports specifying a `cx` stride', function test( t ) var ca; var cx; - cx = new Complex64Array([ 0.1, // 1 0.1, // 1 @@ -150,7 +148,6 @@ tape( 'the `main` method supports specifying a negative `cx` stride', function t var ca; var cx; - cx = new Complex64Array([ 0.1, // 3 0.1, // 3 @@ -231,7 +228,6 @@ tape( 'the `main` method supports view offsets', function test( t ) { var cx1; var ca; - // Initial arrays... cx0 = new Complex64Array([ 0.1, diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js index 01dfe6a30650..21e7ac4a269c 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.main.js @@ -80,7 +80,6 @@ tape( 'a module instance has a `main` method which scales elements from `cx` by var mem; var mod; - mem = new Memory({ 'initial': 1 }); @@ -116,7 +115,6 @@ tape( 'a module instance has a `main` method which supports specifying a `cx` st var mod; var cx; - mem = new Memory({ 'initial': 1 }); @@ -181,7 +179,6 @@ tape( 'a module instance has a `main` method which supports specifying a negativ var mod; var cx; - mem = new Memory({ 'initial': 1 }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js index 3b5b7ab65ab6..5f9ad3efbdb8 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.module.ndarray.js @@ -80,7 +80,6 @@ tape( 'a module instance has an `ndarray` method which scales elements from `cx` var mem; var mod; - mem = new Memory({ 'initial': 1 }); @@ -116,7 +115,6 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` stride', var mod; var cx; - mem = new Memory({ 'initial': 1 }); @@ -181,7 +179,6 @@ tape( 'a module instance has an `ndarray` method which supports a negative `cx` var mod; var cx; - mem = new Memory({ 'initial': 1 }); @@ -246,7 +243,6 @@ tape( 'a module instance has an `ndarray` method which supports a `cx` offset', var mod; var cx; - mem = new Memory({ 'initial': 1 }); @@ -364,7 +360,6 @@ tape( 'a module instance has an `ndarray` method which supports complex access p var mod; var cx; - mem = new Memory({ 'initial': 1 }); diff --git a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js index 592470ccbc92..19da39408aef 100644 --- a/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/wasm/cscal/test/test.ndarray.js @@ -68,7 +68,6 @@ tape( 'the `ndarray` method scales elements from `cx` by `ca`', function test( t var ca; var cx; - cx = new Complex64Array([ 0.3, // 1 0.1, // 1 @@ -113,7 +112,6 @@ tape( 'the `ndarray` method supports specifying a `cx` stride', function test( t var ca; var cx; - cx = new Complex64Array([ 0.1, // 1 0.1, // 1 @@ -158,7 +156,6 @@ tape( 'the `ndarray` method supports specifying a negative `cx` stride', functio var ca; var cx; - cx = new Complex64Array([ 0.1, // 3 0.1, // 3 @@ -203,7 +200,6 @@ tape( 'the `ndarray` method supports a `cx` offset', function test( t ) { var ca; var cx; - cx = new Complex64Array([ 0.1, 0.1, @@ -283,7 +279,6 @@ tape( 'the `ndarray` method supports complex access patterns', function test( t var ca; var cx; - cx = new Complex64Array([ 0.1, 0.1,