Skip to content

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

Open
kgryte wants to merge 1 commit into
developfrom
claude/great-brahmagupta-7ejl49
Open

kgryte wants to merge 1 commit into
developfrom
claude/great-brahmagupta-7ejl49

Conversation

@kgryte

@kgryte kgryte commented Oct 14, 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/srot from relative tolerance testing to ULP difference testing, replacing the computed delta/tol comparisons in the private isApprox helper with @stdlib/number/float32/base/assert/is-almost-same-value (the single-precision variant, matching the already migrated blas/base/srotm and blas/base/csrot).
  • replaces the per-test relative tolerance multipliers with a named ULP constant per test, following the idiom established in blas/base/drot and blas/base/srotm.

Files changed (tests only):

  • test/test.srot.js
  • test/test.srot.native.js
  • test/test.ndarray.js
  • test/test.ndarray.native.js

Measured ULP bounds

Each bound was tightened to the minimum integer that still passes over the full set of expected values in the corresponding test. Minimality was verified mechanically: decrementing any of the bounds below by one produces test failures.

test/test.srot.js and test/test.srot.native.js (in test order):

Test ULP
applies a plane rotation (sx=1, sy=1) 2
applies a plane rotation (sx=2, sy=-2) 6
applies a plane rotation (sx=-2, sy=1) 6
applies a plane rotation (sx=-1, sy=-2) 2
supports an x stride 1
supports negative strides 6
supports complex access patterns 2

test/test.ndarray.js and test/test.ndarray.native.js (in test order):

Test ULP
applies a plane rotation (sx=1, sy=1) 2
applies a plane rotation (sx=2, sy=-2) 6
applies a plane rotation (sx=-2, sy=1) 6
applies a plane rotation (sx=-1, sy=-2) 2
supports an x stride 1
supports an x offset 1
supports a y stride 0
supports a y offset 1
supports negative strides 6
supports complex access patterns 2

Tests which already performed exact comparisons (t.deepEqual/t.strictEqual on exactly representable values) were left untouched.

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?

The native add-on could not be compiled in the environment used to author this change (no gfortran available), so test/test.srot.native.js and test/test.ndarray.native.js were skipped locally and their ULP bounds mirror the JavaScript bounds. This matches the already migrated blas/base/drot and blas/base/srotm, where the JavaScript and native bounds are identical and the test bodies/expected values are the same; a reviewer with add-ons built may want to confirm.

Other

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

  • make test TESTS_FILTER=".*/blas/base/srot/.*" is green (326 + 360 + 5 assertions passing; native tests skipped as above). The suite was run twice at the final ULP values to confirm determinism.
  • make eslint-tests TESTS_FILTER=".*/blas/base/srot/.*" is clean.

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 ULP bounds were measured programmatically (per-element minimum required ULP difference, maximized over each test) rather than guessed, and each bound was verified to be minimal by confirming that one less ULP fails.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01FutYn9SmHmWj5JVPSphjTx


Generated by Claude Code

Migrate the `blas/base/srot` test assertions from relative tolerance
comparisons to ULP difference comparisons using
`@stdlib/number/float32/base/assert/is-almost-same-value`. Each test
uses the minimum required ULP bound.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FutYn9SmHmWj5JVPSphjTx
@stdlib-bot stdlib-bot added BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). Good First PR A pull request resolving a Good First Issue. labels Oct 14, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
blas/base/srot $\\color{green}398/398$
$\\color{green}+100.00\\%$
$\\color{green}17/17$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}398/398$
$\\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 Oct 14, 2026
@kgryte
kgryte marked this pull request as ready for review October 14, 2026 11:36
@kgryte
kgryte requested a review from a team October 14, 2026 11:36
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Oct 14, 2026

@kgryte kgryte left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ULP values need to be inlined.

@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Oct 14, 2026

This branch has not been deployed

No deployments
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. Needs Changes Pull request which needs changes before being merged. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants