diff --git a/lib/node_modules/@stdlib/math/base/special/asinh/test/test.js b/lib/node_modules/@stdlib/math/base/special/asinh/test/test.js index 2dab4dcfa413..69efd4579031 100644 --- a/lib/node_modules/@stdlib/math/base/special/asinh/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/asinh/test/test.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var asinh = require( './../lib' ); @@ -58,8 +57,6 @@ tape( 'main export is a function', function test( t ) { tape( 'the function computes the hyperbolic arcsine on the interval `[-1e-308,-1e-300]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -69,21 +66,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[-1e-308,-1 for ( i = 0; i < x.length; i++ ) { y = asinh( 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 hyperbolic arcsine on the interval `[1e-300,1e-308]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -93,21 +82,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[1e-300,1e- for ( i = 0; i < x.length; i++ ) { y = asinh( 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 hyperbolic arcsine on the interval `[-0.8,0.8]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -117,21 +98,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[-0.8,0.8]` for ( i = 0; i < x.length; i++ ) { y = asinh( 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 hyperbolic arcsine on the interval `[-1.0,-0.8]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -141,21 +114,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[-1.0,-0.8] for ( i = 0; i < x.length; i++ ) { y = asinh( 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 hyperbolic arcsine on the interval `[0.8,1.0]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -165,21 +130,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[0.8,1.0]`' for ( i = 0; i < x.length; i++ ) { y = asinh( 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 hyperbolic arcsine on the interval `[-3.0,-1.0]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -189,21 +146,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[-3.0,-1.0] for ( i = 0; i < x.length; i++ ) { y = asinh( 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 hyperbolic arcsine on the interval `[1.0,3.0]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -213,21 +162,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[1.0,3.0]`' for ( i = 0; i < x.length; i++ ) { y = asinh( 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 hyperbolic arcsine on the interval `[3.0,28.0]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -237,21 +178,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[3.0,28.0]` for ( i = 0; i < x.length; i++ ) { y = asinh( 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 hyperbolic arcsine on the interval `[-28.0,-3.0]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -261,21 +194,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[-28.0,-3.0 for ( i = 0; i < x.length; i++ ) { y = asinh( 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 hyperbolic arcsine on the interval `[28.0,100.0]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -285,21 +210,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[28.0,100.0 for ( i = 0; i < x.length; i++ ) { y = asinh( 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 hyperbolic arcsine on the interval `[-100.0,-28.0]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -309,21 +226,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[-100.0,-28 for ( i = 0; i < x.length; i++ ) { y = asinh( 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 hyperbolic arcsine on the interval `[-1e200,-1e208]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -333,21 +242,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[-1e200,-1e for ( i = 0; i < x.length; i++ ) { y = asinh( 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 hyperbolic arcsine on the interval `[1e300,1e308]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -357,13 +258,7 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[1e300,1e30 for ( i = 0; i < x.length; i++ ) { y = asinh( 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(); });