Skip to content

test: migrate stats/incr/nanmcv to ULP-based assertions - #15412

Merged
kgryte merged 1 commit into
developfrom
philipp/ulp-stats-incr-nanmcv
Sep 22, 2026
Merged

kgryte merged 1 commit into
developfrom
philipp/ulp-stats-incr-nanmcv

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • Migrates stats/incr/nanmcv's test/test.js from relative-tolerance (EPS-based) floating-point assertions to ULP-based assertions using @stdlib/assert/is-almost-same-value.
  • Removes the manual delta/tol computations (and the now-unneeded abs and EPS requires) in favor of t.strictEqual( isAlmostSameValue( actual, expected, N ), true, 'returns expected value' ), mirroring the idiom used in previously merged conversions for other stats/incr/* packages (e.g., stats/incr/mgmean, stats/incr/mse).
  • Uses the minimum required ULP value for each of the 5 converted assertions, determined empirically: all 5 sites pass at 0 ULPs (exact match) over the full fixture set (396 total tape assertions in the file).
  • Verified minimality: 0 is the smallest possible non-negative integer, so this is by construction the tightest bound. The full suite was run three times at this value with identical (fully passing) results, confirming determinism (no FMA/arch flakiness).

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.

Verified via:

NODE_PATH=$(pwd)/lib/node_modules npx tape lib/node_modules/@stdlib/stats/incr/nanmcv/test/test.js

396/396 assertions pass, run three times to confirm determinism. eslint run against the changed file reports no issues. Only test/test.js was changed; there is no test.native.js for this package, and no package.json dependency changes were needed since @stdlib/assert is resolved via the monorepo's NODE_PATH.

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

This PR was written by Claude Code (an autonomous coding agent), which searched for a qualifying candidate package (checking for collisions against existing open/merged ULP-migration PRs), studied prior merged conversions for the same idiom, performed the migration, and empirically determined the minimum ULP bounds described above by running the full test suite and confirming tightness/determinism through repeated runs.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01D2sx1F2BHVSaL578CQbn3f


Generated by Claude Code

Ref: #11352

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

---
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: passed
  - 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 21, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/incr/nanmcv $\\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 Sep 22, 2026
@kgryte
kgryte marked this pull request as ready for review September 22, 2026 09:01
@kgryte
kgryte requested a review from a team September 22, 2026 09:01
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 22, 2026
@kgryte
kgryte merged commit b072b2f into develop Sep 22, 2026
82 checks passed
@kgryte
kgryte deleted the philipp/ulp-stats-incr-nanmcv branch September 22, 2026 09:02
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 22, 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