From e08b3f7634bce7bfdcb6f1123ccfe3c9c86b7467 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 11 Oct 2026 22:26:59 +0000 Subject: [PATCH] test: migrate `constants/float32/half-ln-two` to ULP-based assertions Migrates the `constants/float32/half-ln-two` test suite from relative tolerance testing to ULP difference testing, mirroring the already-merged `constants/float32/ln-ten` migration. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01U6N75xEUk9H2udTb75gi8F --- .../constants/float32/half-ln-two/test/test.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/constants/float32/half-ln-two/test/test.js b/lib/node_modules/@stdlib/constants/float32/half-ln-two/test/test.js index 8a4e1eebcfda..30ac81fa0e08 100644 --- a/lib/node_modules/@stdlib/constants/float32/half-ln-two/test/test.js +++ b/lib/node_modules/@stdlib/constants/float32/half-ln-two/test/test.js @@ -22,8 +22,7 @@ var tape = require( 'tape' ); var lnf = require( '@stdlib/math/base/special/lnf' ); -var absf = require( '@stdlib/math/base/special/absf' ); -var EPS = require( '@stdlib/constants/float32/eps' ); +var isAlmostSameValue = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); var FLOAT32_HALF_LN2 = require( './../lib' ); @@ -42,15 +41,7 @@ tape( 'export is a single-precision floating-point number equal to `0.3465735912 }); tape( 'export equals `0.5*lnf(2)`', function test( t ) { - var delta; - var tol; - var v; - - v = float64ToFloat32( 0.5 * lnf( 2.0 ) ); - delta = absf( float64ToFloat32( v - FLOAT32_HALF_LN2 ) ); - tol = EPS * FLOAT32_HALF_LN2; - - t.ok( delta <= tol, 'equals 0.5*lnf(2) within tolerance '+tol ); - + var v = float64ToFloat32( 0.5 * lnf( 2.0 ) ); + t.strictEqual( isAlmostSameValue( v, FLOAT32_HALF_LN2, 0 ), true, 'returns expected value' ); t.end(); });