Skip to content

test: migrate stats/vartest to ULP-based assertions - #15878

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

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

Conversation

@kgryte

@kgryte kgryte commented Oct 4, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Only test/test.js is modified; no implementation, documentation, or benchmark files are touched. Pre-existing exact assertions (e.g., out.pValue for the ratio option fixture, the 0.0 lower CI bound, and the +Infinity upper CI bound) are left as-is, as exact comparisons remain correct for those cases.

The ULP bounds below are the measured minimums for each comparison: the tests pass at the stated value and fail at one ULP lower, as verified by computing number/float64/base/ulp-difference for every assertion.

Fixture / quantity Previous tolerance ULP bound (measured minimum)
twosided.pValue 250.0 * EPS 253
twosided.statistic 1.0 * EPS 1
twosided.lower (lower CI) 5.0 * EPS 8
twosided.upper (upper CI) 10.0 * EPS 9
diff.statistic 1.0 * EPS 1
diff.lower (lower CI) 6.0 * EPS 8
diff.upper (upper CI) 12.0 * EPS 9
less.pValue 5.0 * EPS 4
less.statistic 1.0 * EPS 1
less.upper (upper CI) 5.0 * EPS 8
greater.pValue 250.0 * EPS 253
greater.statistic 1.0 * EPS 1
greater.lower (lower CI) 1.0 * EPS 1

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.

  • make test TESTS_FILTER=".*/stats/vartest/.*" passes (83/83). The suite was run three times at the final ULP values to confirm the results are deterministic.
  • make lint-javascript-tests TESTS_FILTER=".*/stats/vartest/.*" is clean.

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 by Claude Code, mirroring the migration idiom established by previously merged conversions in this family (e.g., stats/base/dists/exponential/variance, stats/levene-test). The ULP bounds were measured empirically rather than guessed.


@stdlib-js/reviewers


Generated by Claude Code

Ref: #11352

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

---
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: skipped
  - 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 Oct 4, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Hello! 👋

We've noticed that you've been opening a number of PRs addressing good first issues. Thank you for your interest and enthusiasm!

Now that you've made a few contributions, we suggest no longer working on good first issues. Instead, we encourage you to prioritize cleaning up any PRs which have yet to be merged and then proceed to work on more involved tasks.

Not only does this ensure that other new contributors can work on things and get ramped up on all things stdlib, it also ensures that you can spend your time on more challenging problems. 🚀

For ideas for future PRs, feel free to search the codebase for TODOs and FIXMEs and be sure to check out other open issues on the issue tracker. Cheers!

@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/vartest $\\color{green}388/388$
$\\color{green}+100.00\\%$
$\\color{green}60/60$
$\\color{green}+100.00\\%$
$\\color{green}3/3$
$\\color{green}+100.00\\%$
$\\color{green}388/388$
$\\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