Repository navigation
test: migrate blas/base/zaxpy to ULP-based assertions - #16094
Merged
Merged
Conversation
Replace the relative-tolerance `isApprox` helper with ULP difference testing via `@stdlib/assert/is-almost-same-value`, tightening each assertion to the minimum required ULP bound. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TpH47f7GqLWYmKXoVNEzuu --- 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. |
kgryte
marked this pull request as ready for review
October 13, 2026 10:35
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/zaxpyfrom relative tolerance testing to ULP difference testing.isApproxtest helper'sdelta/tolcomputation (rtol * EPS * abs( expected[ i ] )) withisAlmostSameValue( actual[ i ], expected[ i ], ulp )from@stdlib/assert/is-almost-same-value, dropping the now unused@stdlib/constants/float64/epsand@stdlib/math/base/special/absimports and normalizing all assertion messages to'returns expected value'.rtolof14.0at every call site with the minimum required ULP bound for that call site.The migration mirrors the idiom already used by the single-precision sibling package
blas/base/caxpy, which passes a per-call-site integer ULP bound to the sameisApproxhelper shape.Files changed (test files only):
test/test.zaxpy.jstest/test.zaxpy.native.jstest/test.ndarray.jstest/test.ndarray.native.jsMeasured ULP bounds
Each bound below is the measured minimum: the suite passes at the stated value and fails at the value minus one. Bounds were determined by instrumenting
isApproxwith@stdlib/number/float64/base/ulp-differenceto record the maximum observed ULP difference per call site, and then independently confirmed by re-running each call site atN-1.test/test.zaxpy.jsandtest/test.zaxpy.native.js(identical bounds):xbyalphaand adds the result toyxstrideystridexstridesystridestest/test.ndarray.jsandtest/test.ndarray.native.js(identical bounds; the native file additionally coversdcabs1( alpha ) === 0.0):xbyalphaand adds the result toydcabs1( alpha ) === 0.0returns the second input array unchanged (native only)xstridexoffsetystrideyoffsetxstrideystrideThe maximum bound (24 ULP) is driven by the hand-written decimal
expectedfixtures rather than by the implementation; the same effect is visible inblas/base/caxpy, whose corresponding cases converted to 15 ULP.Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
The native test files were exercised against a locally built addon, and their measured bounds came out identical to the JavaScript ones, so the JS and native files carry the same values. Happy to adjust if a different convention is preferred for the
0ULP case intest/test.ndarray.native.js, whereisAlmostSameValuefalls back to exactSameValuecomparison.Other
Verification performed:
make test TESTS_FILTER=".*/blas/base/zaxpy/.*"— 496 assertions passing across all five test files (test.js,test.zaxpy.js,test.zaxpy.native.js,test.ndarray.js,test.ndarray.native.js), run three times with identical results to rule out arch/FMA nondeterminism.make lint-javascript-tests TESTS_FILTER=".*/blas/base/zaxpy/.*"— clean.node-gyp rebuild), so the native bounds are measured rather than inferred.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code, running as an unattended task: it selected the package, studied the already-converted sibling packages (
blas/base/caxpy,blas/base/zdrot) to match the established idiom, performed the migration, and measured and minimized each ULP bound.@stdlib-js/reviewers
Generated by Claude Code