diff --git a/lib/node_modules/@stdlib/math/base/special/acoversinf/test/test.js b/lib/node_modules/@stdlib/math/base/special/acoversinf/test/test.js index b5a6dead2cbd..e08b24feb8aa 100644 --- a/lib/node_modules/@stdlib/math/base/special/acoversinf/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/acoversinf/test/test.js @@ -22,8 +22,8 @@ var tape = require( 'tape' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var randu = require( '@stdlib/random/base/randu' ); -var absf = require( '@stdlib/math/base/special/absf' ); var EPS = require( '@stdlib/constants/float32/eps' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); var acoversinf = require( './../lib' ); @@ -45,8 +45,6 @@ tape( 'main export is a function', function test( t ) { tape( 'the function computes the inverse coversed sine', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -57,22 +55,14 @@ tape( 'the function computes the inverse coversed sine', function test( t ) { for ( i = 0; i < x.length; i++ ) { e = float64ToFloat32( expected[ i ] ); - y = acoversinf( x[i] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[i]+'. E: '+e ); - } else { - delta = absf( y - e ); - tol = 230.0 * EPS * absf( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + y = acoversinf( x[ i ] ); + t.strictEqual( isAlmostSameValuef( y, e, 234 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse coversed sine (small positive numbers)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -83,14 +73,8 @@ tape( 'the function computes the inverse coversed sine (small positive numbers)' for ( i = 0; i < x.length; i++ ) { e = float64ToFloat32( expected[ i ] ); - y = acoversinf( x[i] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[i]+'. E: '+e ); - } else { - delta = absf( y - e ); - tol = EPS * absf( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + y = acoversinf( x[ i ] ); + t.strictEqual( isAlmostSameValuef( y, e, 1 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/acoversinf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/acoversinf/test/test.native.js index c6db143074fd..1b358dd17464 100644 --- a/lib/node_modules/@stdlib/math/base/special/acoversinf/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/acoversinf/test/test.native.js @@ -23,8 +23,8 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var randu = require( '@stdlib/random/base/randu' ); -var absf = require( '@stdlib/math/base/special/absf' ); var EPS = require( '@stdlib/constants/float32/eps' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -54,8 +54,6 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function computes the inverse coversed sine', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -66,22 +64,14 @@ tape( 'the function computes the inverse coversed sine', opts, function test( t for ( i = 0; i < x.length; i++ ) { e = float64ToFloat32( expected[ i ] ); - y = acoversinf( x[i] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[i]+'. E: '+e ); - } else { - delta = absf( y - e ); - tol = 230.0 * EPS * absf( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + y = acoversinf( x[ i ] ); + t.strictEqual( isAlmostSameValuef( y, e, 234 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse coversed sine (small positive numbers)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -92,14 +82,8 @@ tape( 'the function computes the inverse coversed sine (small positive numbers)' for ( i = 0; i < x.length; i++ ) { e = float64ToFloat32( expected[ i ] ); - y = acoversinf( x[i] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[i]+'. E: '+e ); - } else { - delta = absf( y - e ); - tol = EPS * absf( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + y = acoversinf( x[ i ] ); + t.strictEqual( isAlmostSameValuef( y, e, 1 ), true, 'returns expected value' ); } t.end(); });