diff --git a/lib/node_modules/@stdlib/math/base/special/kernel-tan/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/kernel-tan/test/test.native.js index 6d81c89ff3ce..94764b61bae3 100644 --- a/lib/node_modules/@stdlib/math/base/special/kernel-tan/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/kernel-tan/test/test.native.js @@ -24,8 +24,7 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var rempio2 = require( '@stdlib/math/base/special/rempio2' ); -var abs = require( '@stdlib/math/base/special/abs' ); -var EPS = require( '@stdlib/constants/float64/eps' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -77,8 +76,6 @@ tape( 'the function returns `NaN` if provided `NaN` for `x` or `y`', opts, funct tape( 'the function evaluates the tangent for input values inside of `[-pi/4, pi/4]`', opts, function test( t ) { var expected; var values; - var delta; - var tol; var out; var x; var i; @@ -88,15 +85,9 @@ tape( 'the function evaluates the tangent for input values inside of `[-pi/4, pi for ( i = 0; i < values.length; i++ ) { x = values[ i ]; out = kernelTan( x, 0.0, 1 ); - if ( out === expected[ i ] ) { - t.strictEqual( out, expected[ i ], 'returns expected value' ); - } else { - delta = abs( out - expected[ i ] ); - - // NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205 - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. out: '+out+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + + // NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205 + t.strictEqual( isAlmostSameValue( out, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); @@ -104,8 +95,6 @@ tape( 'the function evaluates the tangent for input values inside of `[-pi/4, pi tape( 'the function can be used to compute the tangent for input values outside of `[-pi/4, pi/4]` after argument reduction via `rempio2` (positive)', opts, function test( t ) { var expected; var values; - var delta; - var tol; var out; var x; var y; @@ -119,15 +108,9 @@ tape( 'the function can be used to compute the tangent for input values outside x = values[ i ]; n = rempio2( x, y ); out = kernelTan( y[ 0 ], y[ 1 ], 1 - ( (n&1)<<1 ) ); - if ( out === expected[ i ] ) { - t.strictEqual( out, expected[ i ], 'returns expected value' ); - } else { - delta = abs( out - expected[ i ] ); - - // NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205 - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. out: '+out+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + + // NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205 + t.strictEqual( isAlmostSameValue( out, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); @@ -135,8 +118,6 @@ tape( 'the function can be used to compute the tangent for input values outside tape( 'the function can be used to compute the tangent for input values outside of `[-pi/4, pi/4]` after argument reduction via `rempio2` (negative)', opts, function test( t ) { var expected; var values; - var delta; - var tol; var out; var x; var y; @@ -150,15 +131,9 @@ tape( 'the function can be used to compute the tangent for input values outside x = values[ i ]; n = rempio2( x, y ); out = kernelTan( y[ 0 ], y[ 1 ], 1 - ( (n&1)<<1 ) ); - if ( out === expected[ i ] ) { - t.strictEqual( out, expected[ i ], 'returns expected value' ); - } else { - delta = abs( out - expected[ i ] ); - - // NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205 - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. out: '+out+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + + // NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205 + t.strictEqual( isAlmostSameValue( out, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); });