From e41c683aa28aa8041584eb9779d7544be7719a0f Mon Sep 17 00:00:00 2001 From: DivyanshuVortex Date: Sun, 20 Sep 2026 11:46:17 +0530 Subject: [PATCH] test: migrate math/base/special/asinh to ULP-based testing --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/special/asinh/test/test.native.js | 133 ++---------------- 1 file changed, 14 insertions(+), 119 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/asinh/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/asinh/test/test.native.js index 9f9b5388aef4..2dd7e1b22abd 100644 --- a/lib/node_modules/@stdlib/math/base/special/asinh/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/asinh/test/test.native.js @@ -25,10 +25,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 isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var abs = require( '@stdlib/math/base/special/abs' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -67,8 +66,6 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function computes the hyperbolic arcsine on the interval `[-1e-308,-1e-300]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -78,21 +75,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]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -102,21 +91,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]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -126,21 +107,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]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -150,21 +123,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]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -174,21 +139,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]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -198,21 +155,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]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -222,21 +171,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]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -246,21 +187,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]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -270,21 +203,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]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -294,21 +219,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]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -318,21 +235,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]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -342,21 +251,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]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -366,13 +267,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(); });