Skip to content

test: migrate blas/base/wasm/srot to ULP-based assertions - #15444

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-blas-base-wasm-srot
Sep 23, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-blas-base-wasm-srot

Conversation

@kgryte

@kgryte kgryte commented Sep 23, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates the tests for blas/base/wasm/srot from relative tolerance assertions to ULP difference assertions, as proposed in [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • replaces the EPS/abs based isApprox helper in test/test.main.js, test/test.ndarray.js, test/test.module.main.js, and test/test.module.ndarray.js with @stdlib/number/float32/base/assert/is-almost-same-value, following the single-precision idiom already used in blas/base/wasm/cscal (and mirroring the double-precision migration in blas/base/wasm/drotm).
  • tightens each ULP bound to the minimum integer which still passes over the full fixture set.

The measured minimum ULP bounds are (x / y output arrays, respectively):

File Test ULP (x) ULP (y)
test/test.main.js plane rotation (sx=1, sy=1) 1 2
test/test.main.js plane rotation (sx=2, sy=-2) 6 2
test/test.main.js plane rotation (sx=-2, sy=1) 6 2
test/test.main.js plane rotation (sx=-1, sy=-2) 1 2
test/test.main.js x stride support 1 1
test/test.main.js negative stride support 6 1
test/test.main.js complex access patterns 1 2
test/test.ndarray.js plane rotation (sx=1, sy=1) 1 2
test/test.ndarray.js plane rotation (sx=2, sy=-2) 6 2
test/test.ndarray.js plane rotation (sx=-2, sy=1) 6 2
test/test.ndarray.js plane rotation (sx=-1, sy=-2) 1 2
test/test.ndarray.js x stride support 1 1
test/test.ndarray.js x offset support 1 1
test/test.ndarray.js y stride support 0 0
test/test.ndarray.js y offset support 1 0
test/test.ndarray.js negative stride support 6 1
test/test.ndarray.js complex access patterns 1 2
test/test.module.main.js plane rotation (sx=1, sy=1) 1 2
test/test.module.main.js plane rotation (sx=2, sy=-2) 6 1
test/test.module.main.js plane rotation (sx=-2, sy=1) 6 1
test/test.module.main.js plane rotation (sx=-1, sy=-2) 1 2
test/test.module.main.js x stride support 1 1
test/test.module.main.js y stride support 0 0
test/test.module.main.js negative stride support 6 1
test/test.module.main.js complex access patterns 1 2
test/test.module.ndarray.js plane rotation (sx=1, sy=1) 1 2
test/test.module.ndarray.js plane rotation (sx=2, sy=-2) 6 1
test/test.module.ndarray.js plane rotation (sx=-2, sy=1) 6 1
test/test.module.ndarray.js plane rotation (sx=-1, sy=-2) 1 2
test/test.module.ndarray.js x stride support 1 1
test/test.module.ndarray.js x offset support 1 1
test/test.module.ndarray.js y stride support 0 0
test/test.module.ndarray.js y offset support 1 0
test/test.module.ndarray.js negative stride support 6 1
test/test.module.ndarray.js complex access patterns 1 2

The overall maximum bound is 6; most assertions are satisfied at 0–2.

Bounds were determined by measuring the exact ULP difference of every asserted value, taking the per-call-site maximum, and then confirming minimality: each of the 62 non-zero bounds was individually decremented by one and the corresponding test file re-run, and every one of those 62 runs failed. The full suite (1007 assertions across all seven test files) was run twice at the final bounds with identical results, so the bounds are not sensitive to run-to-run variation.

Only test files are changed; no source, documentation, or benchmark files are touched.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was authored by Claude Code. The test migration was performed mechanically against the idiom established in blas/base/wasm/cscal and blas/base/wasm/drotm, and the ULP bounds were measured empirically rather than guessed.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01MxidB8AeFaVEWsPmCsirHK


Generated by Claude Code

Migrate the tests for `blas/base/wasm/srot` from relative tolerance
assertions to ULP difference assertions.

The `EPS`/`abs` based `isApprox` helper in `test/test.main.js`,
`test/test.ndarray.js`, `test/test.module.main.js`, and
`test/test.module.ndarray.js` is replaced with
`@stdlib/number/float32/base/assert/is-almost-same-value`, following the
idiom already used in `blas/base/wasm/cscal`. Each ULP bound is
tightened to the minimum integer which still passes over the full
fixture set.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MxidB8AeFaVEWsPmCsirHK

---
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-bot stdlib-bot added Good First PR A pull request resolving a Good First Issue. BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). labels Sep 23, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

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!

@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
blas/base/wasm/srot $\\color{green}669/669$
$\\color{green}+100.00\\%$
$\\color{green}17/17$
$\\color{green}+100.00\\%$
$\\color{green}6/6$
$\\color{green}+100.00\\%$
$\\color{green}669/669$
$\\color{green}+100.00\\%$

The above coverage report was generated for the changes in this PR.

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Sep 23, 2026
@kgryte
kgryte marked this pull request as ready for review September 23, 2026 08:38
@kgryte
kgryte requested a review from a team September 23, 2026 08:38
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 23, 2026
@kgryte
kgryte merged commit bf20542 into develop Sep 23, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-blas-base-wasm-srot branch September 23, 2026 08:40
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). Good First PR A pull request resolving a Good First Issue. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants