diff --git a/lib/node_modules/@stdlib/math/base/special/cphasef/test/test.js b/lib/node_modules/@stdlib/math/base/special/cphasef/test/test.js index 0f3fca660bbe..85e8b605bb99 100644 --- a/lib/node_modules/@stdlib/math/base/special/cphasef/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/cphasef/test/test.js @@ -23,9 +23,8 @@ var tape = require( 'tape' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' ); -var absf = require( '@stdlib/math/base/special/absf' ); +var isAlmostSameValue = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var f32 = require( '@stdlib/number/float64/base/to-float32' ); -var EPS = require( '@stdlib/constants/float32/eps' ); var PINF = require( '@stdlib/constants/float32/pinf' ); var NINF = require( '@stdlib/constants/float32/ninf' ); var PI = require( '@stdlib/constants/float32/pi' ); @@ -162,8 +161,6 @@ tape( 'the function returns `-PI/2` if provided a negative `im` and `re=0`', fun tape( 'the function computes the argument of a complex number (when `re` and `im` are positive)', function test( t ) { var expected; var actual; - var delta; - var tol; var re; var im; var i; @@ -174,9 +171,7 @@ tape( 'the function computes the argument of a complex number (when `re` and `im for ( i = 0; i < re.length; i++ ) { actual = cphasef( new Complex64( re[i], im[i] ) ); expected[ i ] = f32( expected[ i ] ); - delta = absf( actual - expected[i] ); - tol = 1.3 * EPS * absf( expected[i] ); - t.strictEqual( delta <= tol, true, 'within tolerance. re: '+re[i]+'. im: '+im[i]+'. Actual: '+actual+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected[ i ], 2 ), true, 'returns expected value' ); } t.end(); }); @@ -184,8 +179,6 @@ tape( 'the function computes the argument of a complex number (when `re` and `im tape( 'the function computes the argument of a complex number (when `re` is negative and `im` is positive)', function test( t ) { var expected; var actual; - var delta; - var tol; var re; var im; var i; @@ -196,9 +189,7 @@ tape( 'the function computes the argument of a complex number (when `re` is nega for ( i = 0; i < re.length; i++ ) { actual = cphasef( new Complex64( re[i], im[i] ) ); expected[ i ] = f32( expected[ i ] ); - delta = absf( actual - expected[i] ); - tol = EPS * absf( expected[i] ); - t.strictEqual( delta <= tol, true, 'within tolerance. re: '+re[i]+'. im: '+im[i]+'. Actual: '+actual+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); @@ -206,8 +197,6 @@ tape( 'the function computes the argument of a complex number (when `re` is nega tape( 'the function computes the argument of a complex number (when `re` and `im` are negative)', function test( t ) { var expected; var actual; - var delta; - var tol; var re; var im; var i; @@ -218,9 +207,7 @@ tape( 'the function computes the argument of a complex number (when `re` and `im for ( i = 0; i < re.length; i++ ) { actual = cphasef( new Complex64( re[i], im[i] ) ); expected[ i ] = f32( expected[ i ] ); - delta = absf( actual - expected[i] ); - tol = EPS * absf( expected[i] ); - t.strictEqual( delta <= tol, true, 'within tolerance. re: '+re[i]+'. im: '+im[i]+'. Actual: '+actual+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cphasef/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cphasef/test/test.native.js index 4a748e809e00..0a096c79279f 100644 --- a/lib/node_modules/@stdlib/math/base/special/cphasef/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cphasef/test/test.native.js @@ -24,9 +24,8 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' ); -var absf = require( '@stdlib/math/base/special/absf' ); +var isAlmostSameValue = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var f32 = require( '@stdlib/number/float64/base/to-float32' ); -var EPS = require( '@stdlib/constants/float32/eps' ); var PINF = require( '@stdlib/constants/float32/pinf' ); var NINF = require( '@stdlib/constants/float32/ninf' ); var PI = require( '@stdlib/constants/float32/pi' ); @@ -171,8 +170,6 @@ tape( 'the function returns `-PI/2` if provided a negative `im` and `re=0`', opt tape( 'the function computes the argument of a complex number (when `re` and `im` are positive)', opts, function test( t ) { var expected; var actual; - var delta; - var tol; var re; var im; var i; @@ -183,9 +180,7 @@ tape( 'the function computes the argument of a complex number (when `re` and `im for ( i = 0; i < re.length; i++ ) { actual = cphasef( new Complex64( re[i], im[i] ) ); expected[ i ] = f32( expected[ i ] ); - delta = absf( actual - expected[i] ); - tol = 1.3 * EPS * absf( expected[i] ); - t.strictEqual( delta <= tol, true, 'within tolerance. re: '+re[i]+'. im: '+im[i]+'. Actual: '+actual+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected[ i ], 2 ), true, 'returns expected value' ); } t.end(); }); @@ -193,8 +188,6 @@ tape( 'the function computes the argument of a complex number (when `re` and `im tape( 'the function computes the argument of a complex number (when `re` is negative and `im` is positive)', opts, function test( t ) { var expected; var actual; - var delta; - var tol; var re; var im; var i; @@ -205,9 +198,7 @@ tape( 'the function computes the argument of a complex number (when `re` is nega for ( i = 0; i < re.length; i++ ) { actual = cphasef( new Complex64( re[i], im[i] ) ); expected[ i ] = f32( expected[ i ] ); - delta = absf( actual - expected[i] ); - tol = EPS * absf( expected[i] ); - t.strictEqual( delta <= tol, true, 'within tolerance. re: '+re[i]+'. im: '+im[i]+'. Actual: '+actual+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); @@ -215,8 +206,6 @@ tape( 'the function computes the argument of a complex number (when `re` is nega tape( 'the function computes the argument of a complex number (when `re` and `im` are negative)', opts, function test( t ) { var expected; var actual; - var delta; - var tol; var re; var im; var i; @@ -227,9 +216,7 @@ tape( 'the function computes the argument of a complex number (when `re` and `im for ( i = 0; i < re.length; i++ ) { actual = cphasef( new Complex64( re[i], im[i] ) ); expected[ i ] = f32( expected[ i ] ); - delta = absf( actual - expected[i] ); - tol = EPS * absf( expected[i] ); - t.strictEqual( delta <= tol, true, 'within tolerance. re: '+re[i]+'. im: '+im[i]+'. Actual: '+actual+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); });