Skip to content

test: migrate stats/incr/nanmvariance to ULP-based assertions - #16204

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-incr-nanmvariance
Oct 24, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-incr-nanmvariance

Conversation

@kgryte

@kgryte kgryte commented Oct 17, 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/nanmvariance from relative tolerance testing to ULP difference testing.
  • replaces the delta/tol computations (tol = EPS * expected) in test/test.js with isAlmostSameValue assertions, adds the @stdlib/assert/is-almost-same-value require, and drops the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.
  • uses a ULP constant of 0 for both migrated assertions. Starting from 64 and tightening, 0 is the measured minimum which still passes: the accumulator reproduces both expected values (19.0 and 12.666666666666666) exactly. This matches the ULP value used by the already migrated sibling package stats/incr/mvariance, which exercises the same input data.

Only test files are modified. The package test suite (406 assertions) passes, and the suite was run twice at the final ULP value to confirm determinism.

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.

Verification performed:

  • make test TESTS_FILTER=".*/stats/incr/nanmvariance/.*" → 406 passing, 0 failing (run twice at ULP 0, identical results).
  • make lint-javascript-tests TESTS_FILTER=".*/stats/incr/nanmvariance/.*" → clean.
  • The migrated assertions were confirmed to be non-vacuous: isAlmostSameValue( actual, expected, 0 ) returns false when the expected value is perturbed by one ULP.

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, which located the candidate package, mirrored the idiom used by already migrated packages, and determined the minimum ULP bound empirically by running the package test suite.


@stdlib-js/reviewers


Generated by Claude Code

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/incr/nanmvariance $\\color{green}152/152$
$\\color{green}+100.00\\%$
$\\color{green}10/10$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}152/152$
$\\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 24, 2026
@kgryte
kgryte marked this pull request as ready for review October 24, 2026 02:24
@kgryte
kgryte requested a review from a team October 24, 2026 02:24
@kgryte
kgryte merged commit 8ccf1c0 into develop Oct 24, 2026
66 checks passed
@kgryte
kgryte deleted the kgryte/ulp-stats-incr-nanmvariance branch October 24, 2026 02:24
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Oct 24, 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. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants