Skip to content

test: migrate blas/base/zscal to ULP-based assertions - #16200

Draft
kgryte wants to merge 1 commit into
developfrom
claude/great-brahmagupta-hdx3sn
Draft

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

Conversation

@kgryte

@kgryte kgryte commented Oct 16, 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/zscal from relative tolerance testing (delta <= rtol * EPS * abs( expected )) to ULP difference testing using @stdlib/assert/is-almost-same-value.
  • replaces the EPS/abs imports with isAlmostSameValue and updates the private isApprox test helper to accept a maximum allowed ULP difference, matching the idiom used in already migrated sibling packages (e.g., blas/base/wasm/zscal and blas/base/zaxpy).
  • tightens each assertion to the minimum ULP value which still passes over the full set of test cases.

Files changed (test files only):

  • test/test.zscal.js
  • test/test.zscal.native.js
  • test/test.ndarray.js
  • test/test.ndarray.native.js

Measured minimum ULP bounds (per test case, in file order):

File ULP values
test/test.zscal.js 1, 4, 4, 2
test/test.zscal.native.js 1, 4, 4, 2
test/test.ndarray.js 1, 4, 4, 10, 10
test/test.ndarray.native.js 1, 4, 4, 10, 10

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 test suites could not be executed locally, as the native add-on was not built in the development environment (the suites were skipped via tryRequire). Following the convention in previously migrated packages, the native test files use the same per-test-case ULP values as their JavaScript counterparts. Please flag if the C implementation is expected to diverge for any of these cases.

Other

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

How the bounds were determined:

  • The maximum observed ULP difference was measured for every test case over the full set of expected values using @stdlib/number/float64/base/ulp-difference.
  • Each bound was then confirmed to be minimal: at N, the suite passes; at N-1, the corresponding test case fails.
  • The suites were run twice at the final values to confirm determinism (test/test.js: 5 passing, test/test.zscal.js: 52 passing, test/test.ndarray.js: 73 passing, 0 failing).
  • make lint-javascript-tests TESTS_FILTER=".*/blas/base/zscal/.*" 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

This PR was authored by Claude Code, running as an unattended automated task. The test migration, the ULP measurements, and the minimality verification were performed by Claude Code; the approach mirrors the idiom established in previously merged migrations for this package family.


@stdlib-js/reviewers


Generated by Claude Code

Ref: #11352

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

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
blas/base/zscal $\\color{green}400/400$
$\\color{green}+100.00\\%$
$\\color{green}17/17$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}400/400$
$\\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