From c80276021065ecccaefd280981ad242af37838da Mon Sep 17 00:00:00 2001 From: Ujjwal Verma Date: Wed, 29 Jul 2026 08:53:39 +0530 Subject: [PATCH] test: migrate math/base/special/acotdf to ULP-based testing --- .../math/base/special/acotdf/test/test.js | 23 +++---------------- .../base/special/acotdf/test/test.native.js | 23 +++---------------- 2 files changed, 6 insertions(+), 40 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/acotdf/test/test.js b/lib/node_modules/@stdlib/math/base/special/acotdf/test/test.js index 52468a6ca689..08a672b32579 100644 --- a/lib/node_modules/@stdlib/math/base/special/acotdf/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/acotdf/test/test.js @@ -22,8 +22,7 @@ var tape = require( 'tape' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); -var absf = require( '@stdlib/math/base/special/absf' ); -var EPS = require( '@stdlib/constants/float32/eps' ); +var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); var acotdf = require( './../lib' ); @@ -44,8 +43,6 @@ tape( 'main export is a function', function test( t ) { tape( 'the function computes the arccotangent in degrees (negative values)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -57,21 +54,13 @@ tape( 'the function computes the arccotangent in degrees (negative values)', fun for ( i = 0; i < x.length; i++ ) { e = float64ToFloat32( expected[ i ] ); y = acotdf( x[ i ] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e ); - } else { - delta = absf( y - e ); - tol = 1.7 * EPS * absf( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValuef( y, e, 2 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the arccotangent in degrees (positive values)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -83,13 +72,7 @@ tape( 'the function computes the arccotangent in degrees (positive values)', fun for ( i = 0; i < x.length; i++ ) { e = float64ToFloat32( expected[ i ] ); y = acotdf( x[ i ] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e ); - } else { - delta = absf( y - e ); - tol = 1.7 * EPS * absf( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValuef( y, e, 2 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/acotdf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/acotdf/test/test.native.js index c1af591e76f6..4d745386fa26 100644 --- a/lib/node_modules/@stdlib/math/base/special/acotdf/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/acotdf/test/test.native.js @@ -23,8 +23,7 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); -var absf = require( '@stdlib/math/base/special/absf' ); -var EPS = require( '@stdlib/constants/float32/eps' ); +var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -53,8 +52,6 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function computes the arccotangent in degrees (negative values)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -66,21 +63,13 @@ tape( 'the function computes the arccotangent in degrees (negative values)', opt for ( i = 0; i < x.length; i++ ) { e = float64ToFloat32( expected[ i ] ); y = acotdf( x[ i ] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e ); - } else { - delta = absf( y - e ); - tol = 1.7 * EPS * absf( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValuef( y, e, 2 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the arccotangent in degrees (positive values)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -92,13 +81,7 @@ tape( 'the function computes the arccotangent in degrees (positive values)', opt for ( i = 0; i < x.length; i++ ) { e = float64ToFloat32( expected[ i ] ); y = acotdf( x[ i ] ); - if ( y === e ) { - t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e ); - } else { - delta = absf( y - e ); - tol = 1.7 * EPS * absf( e ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValuef( y, e, 2 ), true, 'returns expected value' ); } t.end(); });