Skip to content

test: migrate stats/base/dists/laplace/stdev to ULP-based assertions - #14910

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-laplace-stdev
Sep 3, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-laplace-stdev

Conversation

@kgryte

@kgryte kgryte commented Sep 2, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Final ULP constant: 1 for both test/test.js and test/test.native.js.

This is the measured minimum. Starting from a high bound and tightening, the maximum ULP difference over the full 1000-case Python fixture set (test/fixtures/python/data.json) is exactly 1 for both the JavaScript and native implementations (551 of the 1000 cases are bit-for-bit exact). A bound of 0 fails 449 of the 1010 assertions, so 1 cannot be tightened further. The suite was run twice at the final bound with identical results, and the native addon was compiled locally so that test/test.native.js actually executed rather than being skipped:

  • test/test.js: 1010 passing, 0 failing
  • test/test.native.js: 1011 passing, 0 failing

Only the two test files are changed.

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.

The JavaScript and native implementations agree here (both compute a single multiplication by sqrt(2)), so the same ULP bound applies to both files, consistent with other converted stats/base/dists/*/stdev packages.

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 authored by Claude Code running as an automated task. The tolerance-to-ULP conversion, the search for the minimum ULP bound, and the local test/lint verification were all performed by Claude Code.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01M81QiKCao79ZzPSr4XXVrD


Generated by Claude Code

Replace relative tolerance assertions with ULP difference assertions using
`@stdlib/assert/is-almost-same-value`. The measured maximum ULP difference
over the full fixture set is 1 for both the JavaScript and native
implementations, so tests use a bound of 1 ULP.

Resolves a part of #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M81QiKCao79ZzPSr4XXVrD
@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 2, 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/base/dists/laplace/stdev $\\color{green}176/176$
$\\color{green}+100.00\\%$
$\\color{green}9/9$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}176/176$
$\\color{green}+100.00\\%$

The above coverage report was generated for the changes in this PR.

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 Issue #11352 is an RFC explicitly scoped to migrating math/base/special packages from relative-tolerance testing to ULP-difference testing, but this PR modifies tests in stats/base/dists/laplace/stdev, a different package tree not covered by that RFC'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 Sep 3, 2026
@kgryte
kgryte marked this pull request as ready for review September 3, 2026 03:05
@kgryte
kgryte requested a review from a team September 3, 2026 03:05
@kgryte
kgryte merged commit def7690 into develop Sep 3, 2026
66 checks passed
@kgryte
kgryte deleted the kgryte/ulp-laplace-stdev branch September 3, 2026 03:06
@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 Sep 3, 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