Skip to content

test: migrate stats/base/dists/frechet/logcdf to ULP-based assertions - #14720

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-frechet-logcdf
Aug 27, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-frechet-logcdf

Conversation

@kgryte

@kgryte kgryte commented Aug 27, 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 test suite for stats/base/dists/frechet/logcdf from relative tolerance (EPS/delta/tol) assertions to ULP difference assertions using @stdlib/assert/is-almost-same-value.
  • updates test/test.logcdf.js, test/test.factory.js, and test/test.native.js. No other files are changed.

The ULP bound was tightened agentically: starting from a high bound and lowering to the minimum integer which still passes over the full fixture set (large_shape, large_scale, both_large; 1000 cases each, 3000 total per file).

Measured minimum ULP bounds:

File Fixture ULP
test/test.logcdf.js large_shape 24
test/test.logcdf.js large_scale 2
test/test.logcdf.js both_large 20
test/test.factory.js large_shape 24
test/test.factory.js large_scale 2
test/test.factory.js both_large 20
test/test.native.js large_shape 24
test/test.native.js large_scale 2
test/test.native.js both_large 20

Each bound is the exact maximum observed ULP difference over its fixture: lowering 24 to 23 fails one assertion, 20 to 19 fails one assertion, and 2 to 1 fails twenty-nine assertions. The JavaScript and C implementations returned bit-identical results for every fixture value, so the same bounds apply in test/test.native.js as in the JavaScript tests.

For reference, the previous relative tolerances were 20.0 * EPS (large_shape, both_large) and 10.0 * EPS (large_scale), which correspond to looser accuracy budgets than the ULP bounds above, so this is a tightening rather than a relaxation.

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: test/test.js (3 assertions), test/test.logcdf.js (3025 assertions), test/test.factory.js (3022 assertions), and test/test.native.js (3025 assertions) all pass. The native add-on was built locally so that test/test.native.js was actually exercised rather than skipped.
  • The full suite was run twice at the final bounds to confirm determinism (no FMA/architecture-dependent variation).
  • ESLint (tests configuration, etc/eslint/.eslintrc.tests.js) is clean for all changed files.

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 PR was authored by Claude Code as part of an automated, mechanical migration of existing test assertions to ULP-based assertions, following the idiom established in previously merged PRs referencing #11352. The ULP bounds were determined empirically by running the fixtures and minimizing the accepted bound.


@stdlib-js/reviewers


Generated by Claude Code

Replace relative tolerance (`EPS`/`delta`/`tol`) assertions with ULP
difference assertions using `@stdlib/assert/is-almost-same-value`.

The ULP bounds are the measured minimums over the full fixture sets:
`large_shape` (24), `large_scale` (2), and `both_large` (20). The
JavaScript and C implementations return bit-identical results for
every fixture value, so `test/test.native.js` uses the same bounds.

Ref: #11352

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNXbmetYcbrxtMYbT4hMtS
@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 Aug 27, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/frechet/logcdf $\\color{green}324/324$
$\\color{green}+100.00\\%$
$\\color{green}27/27$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}324/324$
$\\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 27, 2026
@kgryte
kgryte marked this pull request as ready for review August 27, 2026 23:56
@kgryte
kgryte requested a review from a team August 27, 2026 23:56
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 27, 2026
@kgryte
kgryte merged commit 4227867 into develop Aug 27, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-frechet-logcdf branch August 27, 2026 23:57
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 27, 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