diff --git a/lib/node_modules/@stdlib/math/base/special/acot/test/test.js b/lib/node_modules/@stdlib/math/base/special/acot/test/test.js index 1aab3ba68761..f8ec4af4f565 100644 --- a/lib/node_modules/@stdlib/math/base/special/acot/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/acot/test/test.js @@ -26,8 +26,7 @@ var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/number/float64/base/assert/is-almost-same-value' ); var acot = require( './../lib' ); @@ -53,8 +52,6 @@ tape( 'main export is a function', function test( t ) { tape( 'the function computes the inverse cotangent for medium positive values', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -63,21 +60,13 @@ tape( 'the function computes the inverse cotangent for medium positive values', expected = mediumPositive.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for medium negative values', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -86,21 +75,13 @@ tape( 'the function computes the inverse cotangent for medium negative values', expected = mediumNegative.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for large positive values', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -109,21 +90,13 @@ tape( 'the function computes the inverse cotangent for large positive values', f expected = largePositive.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for large negative values', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -132,21 +105,13 @@ tape( 'the function computes the inverse cotangent for large negative values', f expected = largeNegative.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for larger positive values', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -155,21 +120,13 @@ tape( 'the function computes the inverse cotangent for larger positive values', expected = largerPositive.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for larger negative values', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -178,21 +135,13 @@ tape( 'the function computes the inverse cotangent for larger negative values', expected = largerNegative.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for huge positive values', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -201,21 +150,13 @@ tape( 'the function computes the inverse cotangent for huge positive values', fu expected = hugePositive.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for huge negative values', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -224,13 +165,7 @@ tape( 'the function computes the inverse cotangent for huge negative values', fu expected = hugeNegative.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/acot/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/acot/test/test.native.js index 069dfe834b4d..b8f71b457e59 100644 --- a/lib/node_modules/@stdlib/math/base/special/acot/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/acot/test/test.native.js @@ -27,8 +27,7 @@ var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/number/float64/base/assert/is-almost-same-value' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -62,8 +61,6 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function computes the inverse cotangent for medium positive values', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -72,21 +69,13 @@ tape( 'the function computes the inverse cotangent for medium positive values', expected = mediumPositive.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for medium negative values', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -95,21 +84,13 @@ tape( 'the function computes the inverse cotangent for medium negative values', expected = mediumNegative.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for large positive values', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -118,21 +99,13 @@ tape( 'the function computes the inverse cotangent for large positive values', o expected = largePositive.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for large negative values', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -141,21 +114,13 @@ tape( 'the function computes the inverse cotangent for large negative values', o expected = largeNegative.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for larger positive values', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -164,21 +129,13 @@ tape( 'the function computes the inverse cotangent for larger positive values', expected = largerPositive.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for larger negative values', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -187,21 +144,13 @@ tape( 'the function computes the inverse cotangent for larger negative values', expected = largerNegative.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for huge positive values', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -210,21 +159,13 @@ tape( 'the function computes the inverse cotangent for huge positive values', op expected = hugePositive.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse cotangent for huge negative values', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -233,13 +174,7 @@ tape( 'the function computes the inverse cotangent for huge negative values', op expected = hugeNegative.expected; for ( i = 0; i < x.length; i++ ) { y = acot( 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]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); });