diff --git a/lib/node_modules/@stdlib/math/base/special/asinf/test/test.js b/lib/node_modules/@stdlib/math/base/special/asinf/test/test.js index 298dbec7d1b7..2ad0063b1eb5 100644 --- a/lib/node_modules/@stdlib/math/base/special/asinf/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/asinf/test/test.js @@ -24,7 +24,7 @@ var tape = require( 'tape' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var EPS = require( '@stdlib/constants/float32/eps' ); var uniform = require( '@stdlib/random/base/uniform' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); var isNegativeZero = require( '@stdlib/assert/is-negative-zero' ); var isPositiveZero = require( '@stdlib/assert/is-positive-zero' ); @@ -48,8 +48,6 @@ tape( 'main export is a function', function test( t ) { tape( 'the function computes the arcsine', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -61,21 +59,13 @@ tape( 'the function computes the arcsine', function test( t ) { for ( i = 0; i < x.length; i++ ) { y = asinf( ( ( x[ i ] ) ) ); e = float64ToFloat32( expected[ i ] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e ); - } else { - delta = abs( y - e ); - tol = 3.3 * EPS * abs( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, e, 5 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the arcsine (small negative values)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -87,21 +77,13 @@ tape( 'the function computes the arcsine (small negative values)', function test for ( i = 0; i < x.length; i++ ) { y = asinf( ( x[ i ] ) ); e = float64ToFloat32( expected[ i ] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e ); - } else { - delta = abs( y - e ); - tol = EPS * abs( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, e, 0 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the arcsine (small positive values)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -113,13 +95,7 @@ tape( 'the function computes the arcsine (small positive values)', function test for ( i = 0; i < x.length; i++ ) { y = asinf( x[ i ] ); e = float64ToFloat32( expected[ i ] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e ); - } else { - delta = abs( y - e ); - tol = EPS * abs( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, e, 0 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/asinf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/asinf/test/test.native.js index 6804101160b8..ae5c728ab381 100644 --- a/lib/node_modules/@stdlib/math/base/special/asinf/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/asinf/test/test.native.js @@ -25,7 +25,7 @@ var tape = require( 'tape' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var EPS = require( '@stdlib/constants/float32/eps' ); var uniform = require( '@stdlib/random/base/uniform' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); var isNegativeZero = require( '@stdlib/assert/is-negative-zero' ); var isPositiveZero = require( '@stdlib/assert/is-positive-zero' ); @@ -57,8 +57,6 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function computes the arcsine', 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 arcsine', opts, function test( t ) { for ( i = 0; i < x.length; i++ ) { y = asinf( ( ( x[ i ] ) ) ); e = float64ToFloat32( expected[ i ] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e ); - } else { - delta = abs( y - e ); - tol = 3.3 * EPS * abs( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, e, 5 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the arcsine (small negative values)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -96,21 +86,13 @@ tape( 'the function computes the arcsine (small negative values)', opts, functio for ( i = 0; i < x.length; i++ ) { y = asinf( ( x[ i ] ) ); e = float64ToFloat32( expected[ i ] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e ); - } else { - delta = abs( y - e ); - tol = EPS * abs( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, e, 0 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the arcsine (small positive values)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -122,13 +104,7 @@ tape( 'the function computes the arcsine (small positive values)', opts, functio for ( i = 0; i < x.length; i++ ) { y = asinf( x[ i ] ); e = float64ToFloat32( expected[ i ] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e ); - } else { - delta = abs( y - e ); - tol = EPS * abs( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, e, 0 ), true, 'returns expected value' ); } t.end(); });