From 49c786907fbd3bee5adebe6a11dcdfb3c01bedcb Mon Sep 17 00:00:00 2001 From: MANDEep22332 Date: Mon, 20 Apr 2026 08:42:50 +0000 Subject: [PATCH 1/3] ULP-based-testing --- .../math/base/special/asinh/test/test.js | 134 ++---------------- 1 file changed, 15 insertions(+), 119 deletions(-) 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..396ab67b5ef8 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,11 +24,11 @@ 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 asinh = require( './../lib' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); + // FIXTURES // @@ -58,8 +58,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 +67,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 +83,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 +99,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 +115,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 +131,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 +147,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 +163,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 +179,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 +195,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 +211,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 +227,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 +243,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 +259,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(); }); From 41413d7fd1fb30d3c7b1971f12c670c1530fac5b Mon Sep 17 00:00:00 2001 From: MANDEep22332 Date: Mon, 20 Apr 2026 09:33:02 +0000 Subject: [PATCH 2/3] fixing the linting error --- lib/node_modules/@stdlib/math/base/special/asinh/test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 396ab67b5ef8..b1547c002f3c 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 @@ -26,8 +26,8 @@ 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 asinh = require( './../lib' ); var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); +var asinh = require( './../lib' ); From 4d6166674bfaeaf9a668bfdd227347fef49febfa Mon Sep 17 00:00:00 2001 From: MANDEep22332 Date: Mon, 20 Apr 2026 09:35:56 +0000 Subject: [PATCH 3/3] fixing the linting error --- lib/node_modules/@stdlib/math/base/special/asinh/test/test.js | 1 - 1 file changed, 1 deletion(-) 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 b1547c002f3c..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 @@ -30,7 +30,6 @@ var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var asinh = require( './../lib' ); - // FIXTURES // var largerNegative = require( './fixtures/julia/larger_negative.json' );