From b12c7d0c7994cd706a8f226b63d650be212c61a2 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 10 Sep 2026 06:21:04 +0000 Subject: [PATCH] test: migrate `stats/incr/nanmprod` to ULP-based assertions Migrate the two relative-tolerance assertion sites in the tests for `stats/incr/nanmprod` to ULP-difference assertions using `@stdlib/assert/is-almost-same-value`. Both sites require a minimum bound of 1 ULP. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_019Fdzvd3XioK2mzPYas59Hf --- 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: skipped - 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 --- --- .../@stdlib/stats/incr/nanmprod/test/test.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/incr/nanmprod/test/test.js b/lib/node_modules/@stdlib/stats/incr/nanmprod/test/test.js index 3514a045af7d..c1456ac26ff7 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmprod/test/test.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmprod/test/test.js @@ -21,9 +21,9 @@ // MODULES // var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPSILON = require( '@stdlib/constants/float64/eps' ); var isEven = require( '@stdlib/math/base/assert/is-even' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); @@ -31,7 +31,6 @@ var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); var normal = require( '@stdlib/random/base/normal' ); var randu = require( '@stdlib/random/base/randu' ); var ldexp = require( '@stdlib/math/base/special/ldexp' ); -var abs = require( '@stdlib/math/base/special/abs' ); var incrnanmprod = require( './../lib' ); @@ -190,8 +189,7 @@ tape( 'the accumulator function can return a result which overflows', function t tape( 'overflow may be transient', function test( t ) { var expected; - var delta; - var tol; + var actual; var acc; var x; var y; @@ -209,10 +207,9 @@ tape( 'overflow may be transient', function test( t ) { acc( y ); acc( z ); - delta = abs( expected - acc() ); - tol = EPSILON * abs( expected ); + actual = acc(); - t.strictEqual( delta <= tol, true, 'within tolerance. Expected: '+expected+'. Actual: '+acc()+'. Delta: '+delta+'. Tol: '+tol+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected, 1 ), true, 'returns expected value' ); t.end(); }); @@ -228,8 +225,7 @@ tape( 'the accumulator function can return a result which underflows', function tape( 'underflow may be transient', function test( t ) { var expected; - var delta; - var tol; + var actual; var acc; var x; var y; @@ -250,10 +246,9 @@ tape( 'underflow may be transient', function test( t ) { acc( z ); - delta = abs( acc() - expected ); - tol = EPSILON * abs( expected ); + actual = acc(); - t.strictEqual( delta <= tol, true, 'within tolerance. Expected: '+expected+'. Actual: '+acc()+'. Delta: '+delta+'. Tol: '+tol+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected, 1 ), true, 'returns expected value' ); t.end(); });