test: migrate blas/base/dzasum to ULP-based assertions - #14893
Merged
Conversation
Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CfbAgTVeRuwnmFGvUZETog --- 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 ---
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
Member
|
An automated check found potentially unrelated issue/PR references in this PR:
Why this matters: GitHub automatically closes issues referenced with What to do:
This assessment was generated by an AI model and is informational only. Generated by Claude Code |
kgryte
marked this pull request as ready for review
September 3, 2026 03:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves a part of #11352.
Description
This pull request:
blas/base/dzasumfrom relative-tolerance assertions to ULP-difference assertions using@stdlib/assert/is-almost-same-value.test/test.dzasum.jsandtest/test.ndarray.js. The package has notest/test.native.js(no native implementation has landed yet), andtest/test.jscontains no tolerance-based assertions and is unchanged.isApprox( t, actual, expected, rtol )helper in each file toisApprox( t, actual, expected, ulp ), replacing thedelta/tolcomputation with a singlet.strictEqual( isAlmostSameValue( actual, expected, ulp ), true, 'returns expected value' ), mirroring the same-family conversion inblas/base/drotm(test: migrateblas/base/drotmto ULP-based assertions #14869).ULPconstant, as inblas/base/drotm, and drops the now-unusedabsandEPSrequires.N <= 0, view offsets, offset support, arity, main export) exactly as-is.ULP bounds
test/test.dzasum.jstest/test.dzasum.jstest/test.dzasum.jstest/test.ndarray.jstest/test.ndarray.jstest/test.ndarray.jstest/test.ndarray.jsEach value is the measured minimum. Starting from a loose bound and tightening, every assertion site was measured directly with
@stdlib/number/float64/base/ulp-difference, and the result was confirmed by re-running the suite with the bounds tightened one step further:ULP = 1have an exact measured ULP difference of1(e.g.dzasum( 4, x, 1 )returns1.5999999999999999against an expected1.6, anddzasum( 3, x, 1 )returns1.2999999999999998against an expected1.3). Lowering those blocks toULP = 0fails 3 assertions intest/test.dzasum.jsand 3 assertions intest/test.ndarray.js, so1cannot be reduced.ULP = 0, which delegates to the SameValue algorithm.0is the tightest bound expressible.Bounds this small are what one expects here:
dzasumis a plain summation ofabs( real )andabs( imag )over a short strided array, so the only error is the accumulated rounding of a handful of additions, and it never exceeds one ULP on these fixtures. The previous relative tolerance of2.0 * EPScorresponds to roughly 2–4 ULP depending on where the expected value falls within its binade, so the new bounds are strictly tighter than the tolerances they replace.The full package suite was run twice at the final bounds to confirm deterministic passing (26 assertions across the 3 test files, all passing on both runs, no FMA/architecture-dependent variation). Linting is clean:
make eslint-tests TESTS_FILTER=".*/blas/base/dzasum/.*"reports no errors for either changed file. The only files changed are the two test files.Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code: the assistant mechanically converted the tolerance-based assertions to
isAlmostSameValue, agentically searched for the minimum ULP bound at every assertion site, verified minimality by re-running the suite one step tighter, confirmed determinism across repeated full runs, and ran the local lint and test suites before submitting.@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01CfbAgTVeRuwnmFGvUZETog
Generated by Claude Code