Skip to content

test: migrate stats/base/dists/geometric/mgf to ULP-based assertions - #15911

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-geometric-mgf
Oct 12, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-geometric-mgf

Conversation

@kgryte

@kgryte kgryte commented Oct 5, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates the tests for stats/base/dists/geometric/mgf from relative tolerance testing to ULP difference testing, following the idiom established in [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • replaces the if ( y === expected[i] ) { ... } else { delta/tol ... } branches in test/test.mgf.js, test/test.factory.js, and test/test.native.js with t.strictEqual( isAlmostSameValue( y, expected[ i ], N ), true, 'returns expected value' );, 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.

Notes on the ULP bounds:

  • Final ULP constants: 4 for the small_p fixtures and 3 for the large_p fixtures, used identically in test.mgf.js, test.factory.js, and test.native.js.
  • The bounds were tightened by starting at 64 and lowering each to the minimum integer which still passes over the full fixture set (1000 values per fixture file). 4 and 3 are the measured minimums: lowering either bound by one produces exactly one failing assertion per fixture set.
  • The previous relative tolerances were 3.0 * EPS (small_p) and 2.0 * EPS (large_p), which is consistent with the measured ULP minimums.
  • The native implementation was built locally and measured independently; it agrees with the JavaScript implementation exactly (same worst-case indices, same minimums), so test.native.js carries the same bounds.
  • The suite was run twice at the final bounds to confirm determinism (no FMA/arch flakiness); both runs reported identical, fully passing results.

Only the test files are changed; no implementation or fixture changes.

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.

Verification performed locally:

  • make test TESTS_FILTER=".*/stats/base/dists/geometric/mgf/.*" → 6047 passing, 0 failing across test.js, test.mgf.js, test.factory.js, and test.native.js (run twice, identical results).
  • The native add-on was built via NODE_ADDONS_PATTERN="geometric/mgf" make install-node-addons, so test.native.js was actually exercised rather than skipped.
  • make eslint-tests TESTS_FILTER=".*/stats/base/dists/geometric/mgf/.*" → 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 authored by Claude Code running as an unattended scheduled task. It studied the prior art in #11352 and the merged conversions for sibling packages in the same family, applied the mechanical conversion, and measured the minimum passing ULP bounds empirically.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_014gfDvKpWTQdKhgDQixTRdu


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 Oct 5, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/geometric/mgf $\\color{green}288/288$
$\\color{green}+100.00\\%$
$\\color{green}19/19$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}288/288$
$\\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 Oct 12, 2026
@kgryte
kgryte marked this pull request as ready for review October 12, 2026 12:57
@kgryte
kgryte requested a review from a team October 12, 2026 12:57
@kgryte
kgryte merged commit 4148aea into develop Oct 12, 2026
66 checks passed
@kgryte
kgryte deleted the kgryte/ulp-geometric-mgf branch October 12, 2026 12:58
@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 Oct 12, 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.

2 participants