diff --git a/lib/node_modules/@stdlib/math/base/special/fast/atanh/test/test.js b/lib/node_modules/@stdlib/math/base/special/fast/atanh/test/test.js index 8409b8f88472..6c68e47f7c22 100644 --- a/lib/node_modules/@stdlib/math/base/special/fast/atanh/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/fast/atanh/test/test.js @@ -21,7 +21,7 @@ // MODULES // var tape = require( 'tape' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); var EPS = require( '@stdlib/constants/float64/eps' ); @@ -48,8 +48,6 @@ tape( 'main export is a function', function test( t ) { tape( 'the function computes the hyperbolic arctangent (negative values)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -59,21 +57,13 @@ tape( 'the function computes the hyperbolic arctangent (negative values)', funct for ( i = 0; i < x.length; i++ ) { y = atanh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 500.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Delta: '+delta+' Tolerance: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 468 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic arctangent (positive values)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -83,13 +73,7 @@ tape( 'the function computes the hyperbolic arctangent (positive values)', funct for ( i = 0; i < x.length; i++ ) { y = atanh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 650.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Delta: '+delta+' Tolerance: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 655 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/fast/atanh/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/fast/atanh/test/test.native.js index 206db8a16112..cb076f926ab2 100644 --- a/lib/node_modules/@stdlib/math/base/special/fast/atanh/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/fast/atanh/test/test.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); var EPS = require( '@stdlib/constants/float64/eps' ); @@ -57,8 +57,6 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function computes the hyperbolic arctangent (negative values)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -68,21 +66,13 @@ tape( 'the function computes the hyperbolic arctangent (negative values)', opts, for ( i = 0; i < x.length; i++ ) { y = atanh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 500.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Delta: '+delta+' Tolerance: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 468 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic arctangent (positive values)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -92,13 +82,7 @@ tape( 'the function computes the hyperbolic arctangent (positive values)', opts, for ( i = 0; i < x.length; i++ ) { y = atanh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 650.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Delta: '+delta+' Tolerance: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 655 ), true, 'returns expected value' ); } t.end(); });