Skip to content

test: migrate stats/base/dists/frechet/cdf to ULP-based assertions - #16242

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-stats-base-dists-frechet-cdf
Draft

kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-stats-base-dists-frechet-cdf

Conversation

@kgryte

@kgryte kgryte commented Oct 19, 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/frechet/cdf from relative tolerance testing to ULP difference testing, replacing the delta/tol computations with @stdlib/assert/is-almost-same-value.

The affected files are test/test.cdf.js, test/test.factory.js, and test/test.native.js. In each file, the abs and @stdlib/constants/float64/eps imports are dropped in favor of isAlmostSameValue, and each if ( y === expected[i] ) { ... } else { delta/tol ... } branch is collapsed into a single t.strictEqual( isAlmostSameValue( y, expected[ i ], <ulp> ), true, 'returns expected value' ); assertion.

ULP bounds

Each fixture-driven test was tightened to the minimum integer ULP bound which still passes over the full 1000-element fixture set. The bounds below were measured per fixture file and verified to be minimal (each fails at <ulp> - 1) for both the main export and the function returned by factory:

Fixture Previous tolerance Final ULP bound Minimum verified
large_shape.json 10.0 * EPS * abs( expected[i] ) 1 fails at 0
large_scale.json 10.0 * EPS * abs( expected[i] ) 16 fails at 15
both_large.json 4100.0 * EPS * abs( expected[i] ) 5950 fails at 5949

The larger bound for both_large.json reflects the loss of relative precision in exp( -pow( z, -alpha ) ) for large shape and scale parameters, where results are evaluated deep in the subnormal-adjacent range (e.g., ~1.16e-191); it is consistent with the previous 4100 * EPS relative tolerance. 93 of the 1000 fixture values in that set differ by more than 100 ULP.

The test suite was run twice at the final bounds with identical results; the implementation relies on stdlib's own exp and pow, so the measured ULP differences are not subject to FMA/architecture variation.

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?

test/test.native.js mirrors the JS bounds. The native add-on is not built in the environment used to prepare this pull request, so those tests were skipped and the native bounds could not be measured independently. Please let me know if the native bounds should be relaxed.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Verification performed:

  • make test TESTS_FILTER=".*/stats/base/dists/frechet/cdf/.*" → 6050 assertions passing (test.cdf.js: 3022, test.factory.js: 3025, test.js: 3); test.native.js skipped (no native add-on built).
  • make eslint-tests TESTS_FILTER=".*/stats/base/dists/frechet/cdf/.*" → clean.
  • make FILES=... lint-license-headers-files → clean.
  • lint-editorconfig-files could not run because the editorconfig-checker release binary could not be downloaded in this environment; the changed files were checked manually for tab indentation, LF line endings, no trailing whitespace, and a final newline.

Only test files are changed; no source, documentation, or fixture files were touched.

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 pull request was authored by Claude Code running as an unattended scheduled task. It studied the prior ULP migrations in this repository, applied the same idiom to this package, and measured the minimum passing ULP bounds empirically against the existing Julia fixtures.


@stdlib-js/reviewers


Generated by Claude Code

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/frechet/cdf $\\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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants