From e84395095a0eeb283e6262683ee51bd5a4ce31a3 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Wed, 10 Jun 2026 02:39:01 -0500 Subject: [PATCH] test: migrate `math/base/special/rempio2f` 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 --- --- .../math/base/special/rempio2f/test/test.js | 33 ++++--------------- .../base/special/rempio2f/test/test.native.js | 33 ++++--------------- 2 files changed, 12 insertions(+), 54 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/rempio2f/test/test.js b/lib/node_modules/@stdlib/math/base/special/rempio2f/test/test.js index afd61fce3234..d24be5505a86 100644 --- a/lib/node_modules/@stdlib/math/base/special/rempio2f/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/rempio2f/test/test.js @@ -27,10 +27,9 @@ var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var incrspace = require( '@stdlib/array/base/incrspace' ); var linspace = require( '@stdlib/array/base/linspace' ); var randu = require( '@stdlib/random/base/randu' ); -var absf = require( '@stdlib/math/base/special/absf' ); var pow = require( '@stdlib/math/base/special/pow' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); -var EPS = require( '@stdlib/constants/float32/eps' ); +var isAlmostSameValue = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var PINF = require( '@stdlib/constants/float32/pinf' ); var NINF = require( '@stdlib/constants/float32/ninf' ); var PIO2 = require( '@stdlib/constants/float32/half-pi' ); @@ -68,8 +67,6 @@ tape( 'the function returns `0` and sets `y[0]` to `NaN` if provided positive or }); tape( 'the function returns `n` and stores `r` as a double-precision floating point number in `y` such that `x - nπ/2 = r` (positive)', function test( t ) { - var delta; - var tol; var x; var y; var z; @@ -85,16 +82,12 @@ tape( 'the function returns `n` and stores `r` as a double-precision floating po t.strictEqual( isNumber( y[ 0 ] ), true, 'returns expected value' ); z = float64ToFloat32( ( PIO2*n ) + ( y[0] ) ); - delta = absf( z - x ); - tol = EPS * absf( x ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. n: '+n+'. y: '+y+'. z: '+z+'. delta: '+delta+'. tol: '+tol+'.' ); + t.strictEqual( isAlmostSameValue( z, x, 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function returns `n` and stores `r` as a double-precision floating point number in `y` such that `x - nπ/2 = r` (tiny positive)', function test( t ) { - var delta; - var tol; var x; var y; var z; @@ -110,16 +103,12 @@ tape( 'the function returns `n` and stores `r` as a double-precision floating po t.strictEqual( isNumber( y[0] ), true, 'returns expected value' ); z = float64ToFloat32( ( PIO2*n ) + ( y[0] ) ); - delta = absf( z - x ); - tol = EPS * absf( x ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. n: '+n+'. y: '+y+'. z: '+z+'. delta: '+delta+'. tol: '+tol+'.' ); + t.strictEqual( z, x, 'returns expected value' ); } t.end(); }); tape( 'the function returns `n` and stores `r` as a double-precision floating point number in `y` such that `x - nπ/2 = r` (negative)', function test( t ) { - var delta; - var tol; var x; var y; var z; @@ -135,16 +124,12 @@ tape( 'the function returns `n` and stores `r` as a double-precision floating po t.strictEqual( isNumber( y[0] ), true, 'returns expected value' ); z = float64ToFloat32( ( PIO2*n ) + ( y[0] ) ); - delta = absf( z - x ); - tol = EPS * absf( x ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. n: '+n+'. y: '+y+'. z: '+z+'. delta: '+delta+'. tol: '+tol+'.' ); + t.strictEqual( isAlmostSameValue( z, x, 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function returns `n` and stores `r` as a double-precision floating point number in `y` such that `x - nπ/2 = r` (tiny negative)', function test( t ) { - var delta; - var tol; var x; var y; var z; @@ -160,16 +145,12 @@ tape( 'the function returns `n` and stores `r` as a double-precision floating po t.strictEqual( isNumber( y[0] ), true, 'returns expected value' ); z = float64ToFloat32( ( PIO2*n ) + ( y[0] ) ); - delta = absf( z - x ); - tol = EPS * absf( x ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. n: '+n+'. y: '+y+'. z: '+z+'. delta: '+delta+'. tol: '+tol+'.' ); + t.strictEqual( z, x, 'returns expected value' ); } t.end(); }); tape( 'the function returns `n` and stores `r` as a double-precision floating point number in `y` such that `x - nπ/2 = r` (multiples of π/4)', function test( t ) { - var delta; - var tol; var x; var y; var z; @@ -186,9 +167,7 @@ tape( 'the function returns `n` and stores `r` as a double-precision floating po t.strictEqual( isNumber( y[0] ), true, 'returns expected value' ); z = float64ToFloat32( ( PIO2*n ) + ( y[0] ) ); - delta = absf( z - x[i] ); - tol = EPS * absf( x[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. n: '+n+'. y: '+y+'. z: '+z+'. delta: '+delta+'. tol: '+tol+'.' ); + t.strictEqual( isAlmostSameValue( z, x[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/rempio2f/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/rempio2f/test/test.native.js index 3e935a0bf446..c1d807e14314 100644 --- a/lib/node_modules/@stdlib/math/base/special/rempio2f/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/rempio2f/test/test.native.js @@ -28,10 +28,9 @@ var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var incrspace = require( '@stdlib/array/base/incrspace' ); var linspace = require( '@stdlib/array/base/linspace' ); var randu = require( '@stdlib/random/base/randu' ); -var absf = require( '@stdlib/math/base/special/absf' ); var pow = require( '@stdlib/math/base/special/pow' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); -var EPS = require( '@stdlib/constants/float32/eps' ); +var isAlmostSameValue = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var PINF = require( '@stdlib/constants/float32/pinf' ); var NINF = require( '@stdlib/constants/float32/ninf' ); var PIO2 = require( '@stdlib/constants/float32/half-pi' ); @@ -78,8 +77,6 @@ tape( 'the function returns `0` and sets `y[0]` to `NaN` if provided positive or }); tape( 'the function returns `n` and stores `r` as a double-precision floating point number in `y` such that `x - nπ/2 = r` (positive)', opts, function test( t ) { - var delta; - var tol; var x; var y; var z; @@ -95,16 +92,12 @@ tape( 'the function returns `n` and stores `r` as a double-precision floating po t.strictEqual( isNumber( y[ 0 ] ), true, 'returns expected value' ); z = float64ToFloat32( ( PIO2*n ) + ( y[0] ) ); - delta = absf( z - x ); - tol = EPS * absf( x ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. n: '+n+'. y: '+y+'. z: '+z+'. delta: '+delta+'. tol: '+tol+'.' ); + t.strictEqual( isAlmostSameValue( z, x, 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function returns `n` and stores `r` as a double-precision floating point number in `y` such that `x - nπ/2 = r` (tiny positive)', opts, function test( t ) { - var delta; - var tol; var x; var y; var z; @@ -120,16 +113,12 @@ tape( 'the function returns `n` and stores `r` as a double-precision floating po t.strictEqual( isNumber( y[0] ), true, 'returns expected value' ); z = float64ToFloat32( ( PIO2*n ) + ( y[0] ) ); - delta = absf( z - x ); - tol = EPS * absf( x ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. n: '+n+'. y: '+y+'. z: '+z+'. delta: '+delta+'. tol: '+tol+'.' ); + t.strictEqual( z, x, 'returns expected value' ); } t.end(); }); tape( 'the function returns `n` and stores `r` as a double-precision floating point number in `y` such that `x - nπ/2 = r` (negative)', opts, function test( t ) { - var delta; - var tol; var x; var y; var z; @@ -145,16 +134,12 @@ tape( 'the function returns `n` and stores `r` as a double-precision floating po t.strictEqual( isNumber( y[0] ), true, 'returns expected value' ); z = float64ToFloat32( ( PIO2*n ) + ( y[0] ) ); - delta = absf( z - x ); - tol = EPS * absf( x ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. n: '+n+'. y: '+y+'. z: '+z+'. delta: '+delta+'. tol: '+tol+'.' ); + t.strictEqual( isAlmostSameValue( z, x, 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function returns `n` and stores `r` as a double-precision floating point number in `y` such that `x - nπ/2 = r` (tiny negative)', opts, function test( t ) { - var delta; - var tol; var x; var y; var z; @@ -170,16 +155,12 @@ tape( 'the function returns `n` and stores `r` as a double-precision floating po t.strictEqual( isNumber( y[0] ), true, 'returns expected value' ); z = float64ToFloat32( ( PIO2*n ) + ( y[0] ) ); - delta = absf( z - x ); - tol = EPS * absf( x ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. n: '+n+'. y: '+y+'. z: '+z+'. delta: '+delta+'. tol: '+tol+'.' ); + t.strictEqual( z, x, 'returns expected value' ); } t.end(); }); tape( 'the function returns `n` and stores `r` as a double-precision floating point number in `y` such that `x - nπ/2 = r` (multiples of π/4)', opts, function test( t ) { - var delta; - var tol; var x; var y; var z; @@ -196,9 +177,7 @@ tape( 'the function returns `n` and stores `r` as a double-precision floating po t.strictEqual( isNumber( y[0] ), true, 'returns expected value' ); z = float64ToFloat32( ( PIO2*n ) + ( y[0] ) ); - delta = absf( z - x[i] ); - tol = EPS * absf( x[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. n: '+n+'. y: '+y+'. z: '+z+'. delta: '+delta+'. tol: '+tol+'.' ); + t.strictEqual( isAlmostSameValue( z, x[ i ], 1 ), true, 'returns expected value' ); } t.end(); });