diff --git a/lib/node_modules/@stdlib/math/base/special/atanh/test/test.js b/lib/node_modules/@stdlib/math/base/special/atanh/test/test.js index c4ede67c26cf..061d48d562c3 100644 --- a/lib/node_modules/@stdlib/math/base/special/atanh/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/atanh/test/test.js @@ -21,7 +21,6 @@ // MODULES // var tape = require( 'tape' ); -var abs = require( '@stdlib/math/base/special/abs' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); var EPS = require( '@stdlib/constants/float64/eps' ); @@ -29,6 +28,7 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' ); var randu = require( '@stdlib/random/base/randu' ); var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var atanh = require( './../lib' ); @@ -50,8 +50,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; @@ -61,21 +59,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]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 1.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), 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; @@ -85,21 +75,13 @@ 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]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 1.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic arctangent (small negative)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -109,21 +91,13 @@ tape( 'the function computes the hyperbolic arctangent (small negative)', functi for ( i = 0; i < x.length; i++ ) { y = atanh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 1.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic arctangent (small positive)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -133,13 +107,7 @@ tape( 'the function computes the hyperbolic arctangent (small positive)', functi for ( i = 0; i < x.length; i++ ) { y = atanh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 1.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/atanh/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/atanh/test/test.native.js index a217359051f9..ef2d194ff206 100644 --- a/lib/node_modules/@stdlib/math/base/special/atanh/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/atanh/test/test.native.js @@ -22,7 +22,6 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var abs = require( '@stdlib/math/base/special/abs' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -31,6 +30,7 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' ); var randu = require( '@stdlib/random/base/randu' ); var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); // FIXTURES // @@ -59,8 +59,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; @@ -70,21 +68,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]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 1.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), 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; @@ -94,21 +84,13 @@ 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]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 1.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic arctangent (small negative)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -118,21 +100,13 @@ tape( 'the function computes the hyperbolic arctangent (small negative)', opts, for ( i = 0; i < x.length; i++ ) { y = atanh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 1.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic arctangent (small positive)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -142,13 +116,7 @@ tape( 'the function computes the hyperbolic arctangent (small positive)', opts, for ( i = 0; i < x.length; i++ ) { y = atanh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 1.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); });