Skip to content

test: migrate stats/incr/prod to ULP-based assertions - #15337

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

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

Conversation

@kgryte

@kgryte kgryte commented Sep 18, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Specifically, this pull request replaces the delta/tol computations in the two t.strictEqual( delta <= tol, ... ) assertions (the "overflow may be transient" and "underflow may be transient" tests) with isAlmostSameValue( actual, expected, 1 ), adds the @stdlib/assert/is-almost-same-value require, and removes the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.

Final ULP constant: 1 for both assertions.

Both assertion sites were tightened to their measured minimum:

Test Expected Actual Minimum ULP
overflow may be transient 1.0715086071862673e+299 1.0715086071862675e+299 1
underflow may be transient 9.332636185032189e-304 9.33263618503219e-304 1

The minimum was measured by evaluating isAlmostSameValue over increasing ULP values and taking the smallest passing integer. Tightness was confirmed by re-running the suite at 0, which fails both assertions (# pass 3425 / # fail 2), while 1 passes all 3427 assertions. The suite was run twice at the final ULP value, with identical results both times, to confirm determinism.

Only test/test.js is modified. The package has no test.native.js.

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.

No.

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 as part of an automated pass over the #11352 migration. The conversion mirrors the idiom established in previously merged stats/incr conversions (e.g. #15257, #15283). The ULP bounds were measured empirically rather than guessed, and verified to be minimal.


@stdlib-js/reviewers


Generated by Claude Code

Migrate the relative tolerance assertions in `stats/incr/prod` tests to
ULP-based assertions using `@stdlib/assert/is-almost-same-value`. Both
converted assertions were tightened to a measured minimum of 1 ULP.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FsMJkqn6MeCqGA4HCRiJEe
@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 18, 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/incr/prod $\\color{green}161/161$
$\\color{green}+100.00\\%$
$\\color{green}11/11$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}161/161$
$\\color{green}+100.00\\%$

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

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