From 96b4feef0faee83f963eca03723067588d5190d5 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 14:24:54 +0000 Subject: [PATCH] test: migrate `constants/float16/ln-half` to ULP-based assertions Migrate the test suite from relative tolerance testing to ULP difference testing, per the idiom established by sibling packages such as `constants/float16/ln-ten` and `constants/float16/half-ln-two`. The computed `lnf(0.5)` value is rounded to half-precision via `@stdlib/number/float64/base/to-float16` so that the ULP difference is measured in half-precision units. The measured minimum required ULP value is 0 (the values are bit-identical). Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Vc6LdYTvcSnCUo61MorWP6 --- .../constants/float16/ln-half/test/test.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/constants/float16/ln-half/test/test.js b/lib/node_modules/@stdlib/constants/float16/ln-half/test/test.js index a06c425399f7..3adf3ba1ec8a 100644 --- a/lib/node_modules/@stdlib/constants/float16/ln-half/test/test.js +++ b/lib/node_modules/@stdlib/constants/float16/ln-half/test/test.js @@ -22,8 +22,8 @@ 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/float16/eps' ); +var isAlmostSameValue = require( '@stdlib/number/float16/base/assert/is-almost-same-value' ); +var float64ToFloat16 = require( '@stdlib/number/float64/base/to-float16' ); var FLOAT16_LN_HALF = require( './../lib' ); @@ -41,15 +41,7 @@ tape( 'export is a half-precision floating-point number equal to `-0.693359375`' }); tape( 'export equals `lnf(0.5)`', function test( t ) { - var delta; - var tol; - var v; - - v = lnf( 0.5 ); - delta = absf( v - FLOAT16_LN_HALF ); - tol = EPS; - - t.ok( delta <= tol, 'equals ln(0.5) within tolerance '+tol ); - + var v = float64ToFloat16( lnf( 0.5 ) ); + t.strictEqual( isAlmostSameValue( v, FLOAT16_LN_HALF, 0 ), true, 'returns expected value' ); t.end(); });