diff --git a/lib/node_modules/@stdlib/math/base/special/asec/test/test.js b/lib/node_modules/@stdlib/math/base/special/asec/test/test.js index a133e5ec5f3e..03c968f0d74f 100644 --- a/lib/node_modules/@stdlib/math/base/special/asec/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/asec/test/test.js @@ -21,9 +21,8 @@ // MODULES // var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); var asec = require( './../lib' ); @@ -49,8 +48,6 @@ tape( 'main export is a function', function test( t ) { tape( 'the function computes the inverse (arc) secant on the interval `[-3.0,-1.0]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -60,21 +57,13 @@ tape( 'the function computes the inverse (arc) secant on the interval `[-3.0,-1. for ( i = 0; i < x.length; i++ ) { y = asec( 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 (arc) secant on the interval `[1.0,3.0]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -84,21 +73,13 @@ tape( 'the function computes the inverse (arc) secant on the interval `[1.0,3.0] for ( i = 0; i < x.length; i++ ) { y = asec( 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 (arc) secant on the interval `[3.0,100.0]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -108,21 +89,13 @@ tape( 'the function computes the inverse (arc) secant on the interval `[3.0,100. for ( i = 0; i < x.length; i++ ) { y = asec( 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 (arc) secant on the interval `[-100.0,-3.0]`', 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 (arc) secant on the interval `[-100.0,- for ( i = 0; i < x.length; i++ ) { y = asec( 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 (arc) secant on the interval `[100.0,1000.0]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -156,21 +121,13 @@ tape( 'the function computes the inverse (arc) secant on the interval `[100.0,10 for ( i = 0; i < x.length; i++ ) { y = asec( 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 (arc) secant on the interval `[-1000.0,-100.0]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -180,21 +137,13 @@ tape( 'the function computes the inverse (arc) secant on the interval `[-1000.0, for ( i = 0; i < x.length; i++ ) { y = asec( 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 (arc) secant on the interval `[-1e200,-1e208]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -204,21 +153,13 @@ tape( 'the function computes the inverse (arc) secant on the interval `[-1e200,- for ( i = 0; i < x.length; i++ ) { y = asec( 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 ], 0 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse (arc) secant on the interval `[1e300,1e308]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -228,13 +169,7 @@ tape( 'the function computes the inverse (arc) secant on the interval `[1e300,1e for ( i = 0; i < x.length; i++ ) { y = asec( 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 ], 0 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/asec/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/asec/test/test.native.js index 5a7e46dbe0c3..f00958473e2e 100644 --- a/lib/node_modules/@stdlib/math/base/special/asec/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/asec/test/test.native.js @@ -22,9 +22,8 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -58,8 +57,6 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function computes the inverse (arc) secant on the interval `[-3.0,-1.0]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -69,21 +66,13 @@ tape( 'the function computes the inverse (arc) secant on the interval `[-3.0,-1. for ( i = 0; i < x.length; i++ ) { y = asec( 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 (arc) secant on the interval `[1.0,3.0]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -93,21 +82,13 @@ tape( 'the function computes the inverse (arc) secant on the interval `[1.0,3.0] for ( i = 0; i < x.length; i++ ) { y = asec( 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 (arc) secant on the interval `[3.0,100.0]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -117,21 +98,13 @@ tape( 'the function computes the inverse (arc) secant on the interval `[3.0,100. for ( i = 0; i < x.length; i++ ) { y = asec( 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 (arc) secant on the interval `[-100.0,-3.0]`', 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 (arc) secant on the interval `[-100.0,- for ( i = 0; i < x.length; i++ ) { y = asec( 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 (arc) secant on the interval `[100.0,1000.0]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -165,21 +130,13 @@ tape( 'the function computes the inverse (arc) secant on the interval `[100.0,10 for ( i = 0; i < x.length; i++ ) { y = asec( 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 (arc) secant on the interval `[-1000.0,-100.0]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -189,21 +146,13 @@ tape( 'the function computes the inverse (arc) secant on the interval `[-1000.0, for ( i = 0; i < x.length; i++ ) { y = asec( 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 (arc) secant on the interval `[-1e200,-1e208]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -213,21 +162,13 @@ tape( 'the function computes the inverse (arc) secant on the interval `[-1e200,- for ( i = 0; i < x.length; i++ ) { y = asec( 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 ], 0 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the inverse (arc) secant on the interval `[1e300,1e308]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -237,13 +178,7 @@ tape( 'the function computes the inverse (arc) secant on the interval `[1e300,1e for ( i = 0; i < x.length; i++ ) { y = asec( 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 ], 0 ), true, 'returns expected value' ); } t.end(); });