Skip to content

test: migrate stats/incr/nanmmse to ULP-based assertions - #15986

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-nanmmse
Draft

kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-nanmmse

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 tests for stats/incr/nanmmse from relative tolerance testing to ULP difference testing, as proposed in [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • replaces the delta/tol relative tolerance computation (and its exact-equality fast path) in test/test.js with a single t.strictEqual( isAlmostSameValue( actual, expected[ i ], 1 ), true, 'returns expected value' ); assertion.
  • adds the @stdlib/assert/is-almost-same-value require and removes the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.

Notes on the chosen ULP bound:

  • The package has a single test file (test/test.js) and no native tests, so one ULP constant covers the entire fixture set.
  • The final ULP value is 1, which is the measured minimum. Per-element ULP differences across the fixture set are [ 0, 0, 0, 0, 1, 0, 0, 1 ], so the maximum observed difference is 1.
  • Tightness was verified by bisecting downward from 64: the suite passes at 64, 2, and 1, and fails at 0 with exactly the two failures corresponding to the two 1-ULP elements.
  • The suite was run twice at the final value of 1 (24 passing both times) to confirm the result is deterministic on this architecture.

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.

  • The only changed file is lib/node_modules/@stdlib/stats/incr/nanmmse/test/test.js; no source, documentation, or fixture values were modified.
  • The conversion mirrors the idiom already used by the sibling packages stats/incr/mmse and stats/incr/nanmrmse.
  • Linting test/test.js with etc/eslint/.eslintrc.tests.js exits cleanly; the one remaining max-len warning is pre-existing and on an untouched line.

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 pull request was authored by Claude Code, running unattended as a scheduled task. It studied #11352 and the already-converted sibling packages to match the project's established idiom, measured the per-element ULP differences, and bisected the ULP bound down to the measured minimum.


@stdlib-js/reviewers


Generated by Claude Code

Replace relative tolerance assertions with ULP difference assertions
using `@stdlib/assert/is-almost-same-value`.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdbV1Qs2TjBQbTP1r2EY7a
@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 Oct 8, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/incr/nanmmse $\\color{green}150/150$
$\\color{green}+100.00\\%$
$\\color{green}8/8$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}150/150$
$\\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

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.

2 participants