Skip to content

test: migrate stats/base/dists/gumbel/median to ULP-based assertions - #14649

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-gumbel-median
Aug 26, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-gumbel-median

Conversation

@kgryte

@kgryte kgryte commented Aug 26, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates test/test.js and test/test.native.js of stats/base/dists/gumbel/median from relative tolerance (EPS-based) assertions to ULP difference assertions via @stdlib/assert/is-almost-same-value.
  • replaces the delta/tol tolerance branch (previously tol = 2.0 * EPS * abs( expected[ i ] )) with t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' ), retaining the existing expected[ i ] !== null guard.
  • removes the now-unused abs and EPS requires and the corresponding delta/tol variable declarations.

Final ULP constant: 0, for both the JavaScript and the native test suites.

The bound was tightened empirically. Starting from a high value and searching downward via a per-case minimum-ULP computation over the full fixture set (test/fixtures/julia/data.json, 100 fixture cases), the measured maximum ULP difference is 0 — every fixture value is reproduced bit-for-bit — so 0 is the minimum value at which the suites pass.

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 native add-on was built locally (make install-node-addons NODE_ADDONS_PATTERN="stats/base/dists/gumbel/median") so that test/test.native.js actually executed rather than being skipped; the native implementation also matches the fixtures exactly (max ULP difference 0).
  • The package test suite was run twice at the final ULP value to confirm determinism: 110/110 assertions passing in test.js and 110/110 in test.native.js on both runs.
  • make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/gumbel/median/.*" is clean.
  • No files other than the two test files were changed.

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.

This pull request was authored by an automated Claude Code agent running as a scheduled task, following the conventions established in previously merged ULP migration pull requests for this issue.


@stdlib-js/reviewers


Generated by Claude Code

Migrate the JavaScript and native test suites from relative tolerance
assertions to ULP difference assertions using
`@stdlib/assert/is-almost-same-value`.

The measured maximum ULP difference across the fixture set is `0` for
both the JavaScript and native implementations, so the tests assert a
maximum allowed difference of `0` ULP.

Resolves a part of #11352.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M4tVv8pEgy2wh9DZoqWqFp
@stdlib-bot stdlib-bot added Good First PR A pull request resolving a Good First Issue. Statistics Issue or pull request related to statistical functionality. and removed Good First PR A pull request resolving a Good First Issue. labels Aug 26, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/gumbel/median $\\color{green}182/182$
$\\color{green}+100.00\\%$
$\\color{green}9/9$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}182/182$
$\\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 Aug 26, 2026
@kgryte
kgryte marked this pull request as ready for review August 26, 2026 10:51
@kgryte
kgryte requested a review from a team August 26, 2026 10:51
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 26, 2026
@kgryte
kgryte merged commit fc55a2c into develop Aug 26, 2026
81 checks passed
@kgryte
kgryte deleted the kgryte/ulp-gumbel-median branch August 26, 2026 10:52
@stdlib-bot stdlib-bot added Good First PR A pull request resolving a Good First Issue. and removed Needs Review A pull request which needs code review. labels Aug 26, 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