Skip to content

test: migrate blas/base/dsymv to ULP-based assertions - #15972

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-blas-base-dsymv
Draft

kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-blas-base-dsymv

Conversation

@kgryte

@kgryte kgryte commented Oct 8, 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 test suite for blas/base/dsymv from relative tolerance assertions to ULP difference assertions.

The shared isApprox test helper previously computed rtol * EPS * abs( expected ) and asserted with t.ok( delta <= tol, ... ). It now delegates to @stdlib/assert/is-almost-same-value:

function isApprox( t, actual, expected, ulp ) {
	var i;

	t.strictEqual( actual.length, expected.length, 'returns expected value' );
	for ( i = 0; i < expected.length; i++ ) {
		t.strictEqual( isAlmostSameValue( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' );
	}
}

Each call site now declares a local ULP bound in place of the previous blanket 2.0 relative tolerance.

Final ULP constant: 0 at every call site.

File Call sites ULP bounds (in call order)
test/test.dsymv.js 10 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
test/test.ndarray.js 10 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

Notes on how the bounds were measured:

  • The bounds were measured empirically by instrumenting isApprox to compute, per call site, the maximum @stdlib/number/float64/base/ulp-difference over every compared element. The measured maximum was 0 for all 20 call sites, i.e., the computed output is bit-identical to the fixture values for every element in both the main and ndarray test files. The previous 2.0 * EPS relative tolerance was therefore never exercised.
  • 0 is the floor for a nonnegative ULP bound, so minimality is exact rather than approximate. Note that isAlmostSameValue( a, b, 0 ) reduces to isSameValue( a, b ); the probe additionally confirmed isSameValue holds for every compared element, so signed-zero handling is unaffected.
  • The suite was run twice at the final bounds to confirm determinism; all 103 assertions pass both times, and the assertion count is unchanged from before the migration (the previous helper also emitted exactly one assertion per element).
  • This package has no test.native.js variants, so there is no JS/C divergence to account for.
  • Only the two test files are modified; no source, documentation, or fixture changes.

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?

One, flagged for explicit review:

  • test/test.dsymv.js carried a pre-existing stdlib/no-empty-lines-between-requires lint error on the blank line separating the row-major and column-major fixture requires (line 41 on develop). Since the pre-commit hook lints changed test files with FIX=1, that blank line is auto-removed, and this PR therefore includes that one-line whitespace fix. It is unrelated to the ULP migration and can be dropped if you would rather keep the visual grouping and address the lint error separately. (Curiously, test/test.ndarray.js has a byte-identical fixture block but is not flagged by the rule.)

Other

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

Because dsymv is exercised only through its JavaScript implementation here, the bit-exactness above is IEEE-754 reproducible and not subject to FMA-contraction differences across architectures.

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. It studied the already-converted packages in the same family (notably blas/base/drot and blas/base/dzasum) to match the established isApprox/ULP idiom, then measured the minimum ULP bound for each call site empirically and verified determinism as described above.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01WbopwtTe2hqYuudNtoJxSS


Generated by Claude Code

Migrate the test suite from relative tolerance assertions to ULP
difference assertions.

The `isApprox` test helper now delegates to
`@stdlib/assert/is-almost-same-value`, and each call site specifies the
minimum ULP bound required to pass. Every compared element is bit-exact
against the fixtures, so the measured minimum is zero ULP for all call
sites in both files.

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

---
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 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 8, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
blas/base/dsymv $\\color{green}470/470$
$\\color{green}+100.00\\%$
$\\color{green}75/75$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}470/470$
$\\color{green}+100.00\\%$

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

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants