Skip to content

test: migrate stats/incr/nancovariance to ULP-based assertions - #14571

Merged
kgryte merged 2 commits into
developfrom
kgryte/ulp-stats-incr-nancovariance
Aug 25, 2026
Merged

test: migrate stats/incr/nancovariance to ULP-based assertions#14571
kgryte merged 2 commits into
developfrom
kgryte/ulp-stats-incr-nancovariance

Conversation

@kgryte

@kgryte kgryte commented Aug 23, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

ULP bound: 0, the measured minimum. The package has no test/test.native.js, so test/test.js is the only test file changed.

The bound was determined empirically rather than assumed. Starting from a high bound and lowering it, the accumulated covariance for the fixture sequence in the affected test is bit-identical to the expected value 14/3: the measured ULP difference between the returned value (4.666666666666667) and the expected value is exactly 0, so the bound cannot be tightened further. The suite was then run twice at the final bound with identical results (15/15 passing in each run), so the bound is not sensitive to run-to-run variation.

A bound of 0 is stable here because the accumulator is pure double-precision JavaScript arithmetic: stats/incr/nancovariance delegates to stats/incr/covariance, whose Welford-style update uses only IEEE-754 addition, subtraction, multiplication, and division, all of which are correctly rounded and reproducible across platforms (JavaScript performs no FMA contraction). The previous relative tolerance was EPS * abs( expected ), i.e. roughly one ULP at this magnitude, so 0 sits within the prior accuracy budget rather than loosening it.

Only the one test file is modified; no implementation, fixture, or documentation changes are included.

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.

Notes on local verification:

  • make test TESTS_FILTER=".*/stats/incr/nancovariance/.*" passes 15/15 assertions, run twice.
  • make lint-javascript-tests TESTS_FILTER=".*/stats/incr/nancovariance/.*" reports no problems.
  • make install-node-modules initially failed in this environment because the local npm cache held a stale packument for es-object-atoms, causing es-object-atoms@^1.1.2 to resolve as nonexistent. Clearing the npm cache resolved it; no repository files were involved.
  • make lint-editorconfig-files (run via the pre-commit hook) could not execute because the editorconfig-checker binary download is blocked in this environment. The changed file was instead checked manually for indentation (tabs), trailing whitespace, line endings (LF), and final newline, and matches the surrounding files exactly.

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 authored by Claude Code running as an unattended scheduled task. It studied previously merged conversions under #11352 (including the stats/incr/nanskewness sibling) to match the established idiom, applied the migration, measured the minimum ULP bound empirically against the values exercised by the test, and verified that the tests pass and that the file lints cleanly.


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

stdlib-bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

No coverage information available.

Copy link
Copy Markdown
Member

⚠️ Issue Reference Review

An automated check found potentially unrelated issue/PR references in this PR:

Reference Assessment Reasoning
#11352 suspicious #11352 is an RFC/tracking issue explicitly scoped to migrating math/base/special packages to ULP-based testing, but this PR migrates tests for stats/incr/nancovariance, which is outside that issue's stated scope.

Why this matters: GitHub automatically closes issues referenced with
closing keywords (Resolves, Closes, Fixes) when the PR is merged. Incorrect
references can accidentally close unrelated issues.

What to do:

  • If the reference is correct, no action needed. This check may produce
    false positives.
  • If the reference is incorrect, please update your PR description.

This assessment was generated by an AI model and is informational only.


Generated by Claude Code

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Aug 25, 2026
@kgryte
kgryte marked this pull request as ready for review August 25, 2026 00:17
@kgryte
kgryte requested a review from a team August 25, 2026 00:17
Signed-off-by: Athan <kgryte@gmail.com>
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 25, 2026
@kgryte
kgryte merged commit 61b94b8 into develop Aug 25, 2026
28 checks passed
@kgryte
kgryte deleted the kgryte/ulp-stats-incr-nancovariance branch August 25, 2026 00:45
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 25, 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.

4 participants