Conversation
Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014LQ8huwgQVRDzd3oPQiTXw --- 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. |
This branch has not been deployed
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/wasm/csrotfrom relative tolerance testing to ULP difference testing, replacing the computeddelta/tolcomparisons with@stdlib/number/float32/base/assert/is-almost-same-value.Concretely, in each of
test/test.main.js,test/test.ndarray.js,test/test.module.main.js, andtest/test.module.ndarray.js, the following helperis replaced by
along with adding the
@stdlib/number/float32/base/assert/is-almost-same-valuerequire and dropping the now-unused@stdlib/math/base/special/absand@stdlib/constants/float32/epsrequires.As this package operates on single-precision complex floating-point numbers, the tests use the single-precision assertion utility (
isAlmostSameValuef), matching the convention already established by the sibling packagesblas/base/wasm/cscal,blas/base/wasm/srot, andblas/base/wasm/drotm, whose converted test files use the sameisApprox( t, actual, expected, ulp )helper shape with a per-call-site integer ULP bound.ULP bounds
Every tolerance-based assertion in this package compares a
Float32Arrayview against expectedFloat32Arrayvalues, inviewX/viewYpairs. The measured minimum differs between the two members of each pair, so each assertion carries its own bound rather than a single uniform value:isApprox( t, viewX, cxe, ... )00isApprox( t, viewY, cye, ... )11The bounds are identical across all four files and across all test cases (plane rotation,
xstride,ystride, negative strides, complex access patterns, and view offsets), replacing the previous uniform2.0relative tolerance (i.e.,2.0 * EPS * abs( expected )) at every call site.The bounds were tightened empirically rather than guessed. Starting from a high value and lowering it, the
viewXresults are bit-exact against the expected values and so pass at0, while theviewYresults differ by exactly one ULP and so fail at0and pass at1:So
1is the tightest possible non-exact bound for theviewYassertions, and theviewXassertions require no tolerance at all. Minimality was confirmed in both directions: lowering theviewYbound to0makestest/test.main.jsfail (9 failing assertions out of 122), while the chosen bounds pass everywhere.The full test suite was run twice at the final values to confirm the result is stable (no FMA/arch-dependent variation); both runs report identical passing counts and
0failures.Note that the prior state of this package applied a uniform
2.0 * EPSrelative tolerance to both members of each pair, which is why theviewXcases were not previously distinguishable as exact. If reviewers would prefer a uniform1in both positions — trading the tighter bound for robustness against a future bit-level change inblas/base/csrot— that is a one-character change per call site and I am happy to make it.Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
Only the one noted above: whether the exact (
0ULP) bound on theviewXassertions is preferred over a uniform1, given that the issue asks for the minimum required ULP value.Other
Only the four test files containing tolerance-based assertions are modified; no source, documentation, benchmark, or fixture files are touched.
test/test.js,test/test.module.js, andtest/test.routine.jscontain no tolerance-based assertions and are left unchanged. The assertion count is unchanged by this migration, as the removed exact/approximate branch emitted exactly one assertion per element either way.Verification performed:
make test TESTS_FILTER=".*/blas/base/wasm/csrot/.*"—536passing,0failing across all seven test files. Run twice, with identical results.viewYbound lowered to0, which fails as expected (113passing,9failing intest/test.main.js).make lint-javascript-tests TESTS_FILTER=".*/blas/base/wasm/csrot/.*"— clean,0problems across all files..editorconfig, as theeditorconfig-checkerbinary could not be downloaded in the sandbox used to author this change.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code running as an unattended task. It studied the migration idiom from previously converted sibling packages in the same family (
blas/base/wasm/cscal,blas/base/wasm/srot,blas/base/wasm/drotm), applied the mechanical substitution to the four affected test files, and determined the ULP bounds by instrumenting the test helper to report the maximum observed ULP distance per call site, then confirming that a lower bound fails while the chosen bound passes and re-running the suite to confirm the result is deterministic.@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_014LQ8huwgQVRDzd3oPQiTXw
Generated by Claude Code