Skip to content

test: migrate stats/base/dists/gumbel/logpdf to ULP-based assertions - #15727

Merged
kgryte merged 2 commits into
developfrom
claude/great-brahmagupta-y9rx8q
Oct 1, 2026
Merged

kgryte merged 2 commits into
developfrom
claude/great-brahmagupta-y9rx8q

Conversation

@kgryte

@kgryte kgryte commented Oct 1, 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 stats/base/dists/gumbel/logpdf test suite from relative-tolerance assertions to ULP difference assertions, per [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • Replaces the delta/tol (EPS * abs( expected[i] )) comparisons in test/test.logpdf.js, test/test.factory.js, and test/test.native.js with t.strictEqual( isAlmostSameValue( y, expected[ i ], <ulp> ), true, 'returns expected value' );.
  • Adds the @stdlib/assert/is-almost-same-value require and drops the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires (and the associated delta/tol declarations).

Measured ULP bound: 0 in all three test files.

The bound was determined by starting high and tightening: every non-null fixture case (2994 comparisons per entry point, across positive_mean.json, negative_mean.json, and large_variance.json) matches the Julia reference value exactly, for the JavaScript implementation, the factory variant, and the native C implementation. 0 is therefore the minimum required value, and it is the same for test.native.js as for the JavaScript tests.

Verification:

  • make test TESTS_FILTER=".*/stats/base/dists/gumbel/logpdf/.*" is green — 9033 assertions passing across test.js, test.logpdf.js, test.factory.js, and test.native.js.
  • The native add-on was built locally so that test/test.native.js actually executes rather than being skipped.
  • The suite was run twice at the final ULP value to confirm determinism (no FMA/architecture-dependent flakiness).
  • Only the three test files are changed; no implementation, fixture, documentation, or benchmark files were touched.

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 conversion mirrors the idiom already established in sibling packages in the same family (e.g. stats/base/dists/gumbel/pdf, stats/base/dists/gumbel/cdf), including the placement of the isAlmostSameValue require and the 'returns expected value' assertion message.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

  • Read, understood, and followed the [contributing guidelines][contributing].

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. The test migration and the ULP bound measurement were performed by Claude Code, mirroring the idiom of previously merged conversions in the same package family.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_0135QJfR8bGavjhc1uUUPM3g


Generated by Claude Code

Replace relative-tolerance assertions in the `stats/base/dists/gumbel/logpdf`
test suite with ULP difference assertions using
`@stdlib/assert/is-almost-same-value`.

All fixture cases match the Julia reference values exactly, so the minimum
required ULP bound is 0 for `test.logpdf.js`, `test.factory.js`, and
`test.native.js`.

Resolves a part of #11352.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0135QJfR8bGavjhc1uUUPM3g
@stdlib-bot stdlib-bot added the Good First PR A pull request resolving a Good First Issue. label Oct 1, 2026
@stdlib-bot

stdlib-bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/gumbel/logpdf $\\color{green}298/298$
$\\color{green}+100.00\\%$
$\\color{green}23/23$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}298/298$
$\\color{green}+100.00\\%$

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

@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Oct 1, 2026
@kgryte kgryte added the Tests Pull requests specifically adding tests. label Oct 1, 2026
@kgryte
kgryte marked this pull request as ready for review October 1, 2026 06:39
@kgryte
kgryte requested a review from a team October 1, 2026 06:39
Comment thread lib/node_modules/@stdlib/stats/base/dists/gumbel/logpdf/test/test.native.js Outdated
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Oct 1, 2026
Signed-off-by: Athan <kgryte@gmail.com>
@kgryte
kgryte merged commit fadc35f into develop Oct 1, 2026
12 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-y9rx8q branch October 1, 2026 06:44
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Oct 1, 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.

3 participants