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..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 @@ -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' ); } } @@ -102,7 +93,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, 1 ); t.end(); }); @@ -146,7 +137,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, 1 ); t.end(); }); @@ -190,7 +181,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, 1 ); t.end(); }); @@ -270,7 +261,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, 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 0682b2b8dcca..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 @@ -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' ); } } @@ -108,7 +99,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, 0 ); t.end(); }); @@ -172,7 +163,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, 1 ); t.end(); }); @@ -236,7 +227,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, 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 3630cf851911..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 @@ -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' ); } } @@ -108,7 +99,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, 0 ); t.end(); }); @@ -172,7 +163,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, 1 ); t.end(); }); @@ -236,7 +227,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, 1 ); t.end(); }); @@ -300,7 +291,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, 1 ); t.end(); }); @@ -417,7 +408,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, 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 23dd569f8be9..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 @@ -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' ); } } @@ -110,7 +101,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, 1 ); t.end(); }); @@ -154,7 +145,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, 1 ); t.end(); }); @@ -198,7 +189,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, 1 ); t.end(); }); @@ -242,7 +233,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, 5 ); t.end(); }); @@ -325,7 +316,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, 5 ); t.end(); }); 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(); });