test: migrate blas/base/drot to ULP-based assertions - #15025
Conversation
Replaces the relative tolerance assertions in the `blas/base/drot` tests with ULP-based assertions using `@stdlib/assert/is-almost-same-value`, mirroring the conventions established in `blas/base/drotm`. Each ULP bound is the measured minimum required by the corresponding fixture set. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JXfLRBopGnbspYy9pzBY29 --- 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 ---
|
Hello! 👋 We've noticed that you've been opening a number of PRs addressing good first issues. Thank you for your interest and enthusiasm! Now that you've made a few contributions, we suggest no longer working on good first issues. Instead, we encourage you to prioritize cleaning up any PRs which have yet to be merged and then proceed to work on more involved tasks. Not only does this ensure that other new contributors can work on things and get ramped up on all things stdlib, it also ensures that you can spend your time on more challenging problems. 🚀 For ideas for future PRs, feel free to search the codebase for TODOs and FIXMEs and be sure to check out other open issues on the issue tracker. Cheers! |
Coverage Report
The above coverage report was generated for the changes in this PR. |
Resolves a part of #11352.
Description
This pull request:
blas/base/drotfrom relative tolerance testing to ULP difference testing, replacing thertol * EPS * abs( expected )comparisons in theisApproxhelper with@stdlib/assert/is-almost-same-value. The idiom mirrors the already-migrated sibling packageblas/base/drotm.Files changed:
test/test.drot.js,test/test.drot.native.js,test/test.ndarray.js, andtest/test.ndarray.native.js. No non-test files are modified, and no test fixtures, expected values, or test cases were added, removed, or altered.Each
ULPconstant is the measured minimum for its fixture set. Bounds were determined by computing, for every compared element, the smallestnfor whichisAlmostSameValue( actual, expected, n )returnstrue, and taking the per-test maximum. Each bound was then verified to be minimal by confirming that the test fails atULP - 1.test/test.drot.jsandtest/test.drot.native.js:rtolxstridetest/test.ndarray.jsandtest/test.ndarray.native.js:rtolxstridexoffsetystrideyoffsetTests using exact assertions (
t.deepEqual) were left unchanged.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
21ULP bounds are driven by a single element in each of those fixture sets. For the(sx=2, sy=-2)case, the last rotatedxelement is0.8*(-0.4) + 0.6*0.5, which is subject to catastrophic cancellation: the computed value is-0.020000000000000073against an expected literal of-0.02. The previous relative tolerance (20 * EPS * abs( expected )) permitted roughly 25 ULP at that magnitude, so21is a tightening rather than a relaxation, but reviewers may prefer a different treatment of that fixture.Other
The bounds above were measured against the JavaScript implementations. The native test files use the same bounds, matching the convention in the already-migrated
blas/base/drotmandblas/base/srotm. The native add-on could not be built locally (gfortranis unavailable in the environment used to author this change), so the native bounds are unverified locally and rely on CI. Marked as a draft for that reason.The JavaScript test suite was run twice at the final bounds with identical results (326 assertions in
test.drot.js, 360 intest.ndarray.js, all passing), confirming determinism.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code. The migration follows the idiom established in the already-migrated
blas/base/drotm, and the ULP bounds were measured empirically rather than guessed.@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01JXfLRBopGnbspYy9pzBY29
Generated by Claude Code