Skip to content

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

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-stats-incr-nanmvariance
Draft

kgryte wants to merge 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.

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.

3 participants