Skip to content

test: migrate stats/base/snanstdevtk to ULP-based assertions - #15599

Merged
kgryte merged 1 commit into
developfrom
philipp/ulp-snanstdevtk
Sep 27, 2026
Merged

kgryte merged 1 commit into
developfrom
philipp/ulp-snanstdevtk

Conversation

@Planeshifter

@Planeshifter Planeshifter commented Sep 27, 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 stats/base/snanstdevtk test suite from the computed EPS/tolerance idiom (delta = abs( v - expected ); tol = 1.0 * EPS * abs( expected ); t.strictEqual( delta <= tol, ... )) to ULP-difference assertions using @stdlib/number/float32/base/assert/is-almost-same-value (isAlmostSameValuef), per [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • updates test/test.snanstdevtk.js, test/test.snanstdevtk.native.js, test/test.ndarray.js, and test/test.ndarray.native.js (the four files containing the tolerance idiom).
  • the tightest ULP bound was determined empirically: starting from a high bound and lowering it, 1 is the minimum integer ULP distance for which all assertions in all four files pass; 0 fails 2 of the 36 assertions in each file. This matches the ULP bound already settled on for the sibling package stats/base/snanstdev (see PR test: migrate stats/base/snanstdev to ULP-based assertions #15216), whose test files follow an identical pattern.
  • verified determinism by running each of the four test files twice at ULP 1 with identical (all-passing) results.

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.

Only the four test files were changed; no new dependency was introduced (@stdlib/number/float32/base/assert/is-almost-same-value already exists in the monorepo and is already used by other converted packages, e.g. stats/base/snanstdev). npx eslint on the changed files reports no issues, and make test TESTS_FILTER=".*/stats/base/snanstdevtk/.*" passes (36/36 in each JS test file; native variants report 0 tests, as expected when the native addon is not built in this environment).

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 written primarily by Claude Code, running as an unattended scheduled task: it discovered the candidate package, studied prior art from already-merged ULP-migration PRs (including #15216 for the sibling snanstdev package), performed the conversion, and empirically determined the tightest ULP bound.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01WLQVoEVhUdPCfyaqueCuD5


Generated by Claude Code

Replaces the computed EPS/tolerance idiom (`abs( v - expected ) <= tol`)
with `isAlmostSameValuef` ULP-difference comparisons in the package's
four strided-array test files. Mirrors the approach already used in the
sibling `stats/base/snanstdev` package.

Ref: #11352

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

---
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 Statistics Issue or pull request related to statistical functionality. Good First PR A pull request resolving a Good First Issue. labels Sep 27, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/snanstdevtk $\\color{green}365/365$
$\\color{green}+100.00\\%$
$\\color{green}14/14$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}365/365$
$\\color{green}+100.00\\%$

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

@kgryte
kgryte marked this pull request as ready for review September 27, 2026 22:01
@kgryte
kgryte requested a review from a team September 27, 2026 22:01
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 27, 2026
@kgryte
kgryte merged commit 7ec1a1c into develop Sep 27, 2026
70 checks passed
@kgryte
kgryte deleted the philipp/ulp-snanstdevtk branch September 27, 2026 22:02
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants