Skip to content

test: migrate stats/base/dists/frechet/variance to ULP-based assertions - #14434

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-frechet-variance
Aug 20, 2026
Merged

test: migrate stats/base/dists/frechet/variance to ULP-based assertions#14434
kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-frechet-variance

Conversation

@kgryte

@kgryte kgryte commented Aug 20, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Specifically, in both test/test.js and test/test.native.js, the if ( y === expected[i] ) { ... } else { delta/tol ... } branch in the fixture loop is replaced with a single assertion:

t.strictEqual( isAlmostSameValue( y, expected[ i ], 66 ), true, 'returns expected value' );

The now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires are removed, and @stdlib/assert/is-almost-same-value is added. No other test cases were touched, and no non-test files were changed.

ULP constant: 66 in both test/test.js and test/test.native.js.

This is the measured minimum. Over the full Julia fixture set (63 non-null cases), the maximum observed ULP difference between the returned and expected values is exactly 66, attained at alpha = 4.728181271575317, s = 3.0858597298664217 (returned 1.5059173686166538 vs. expected 1.5059173686166392). The suite passes at 66 and fails at 65, and passes across repeated runs. For reference, the previous relative tolerance was 45.0 * EPS.

The same constant is used in test/test.native.js, matching the convention used by the already-migrated sibling packages in this distribution (e.g. stats/base/dists/frechet/kurtosis, mode, entropy).

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?

The native add-on was not built in the environment used to author this change, so test/test.native.js was skipped locally and the 66 bound there is inherited from the JavaScript measurement (as in the sibling frechet packages). Happy to adjust if CI shows a different bound is required for the C implementation.

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/variance/.*" — 78/78 passing, run twice with identical results.
  • make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/frechet/variance/.*" — clean (the only remaining diagnostic is a pre-existing cspell warning on "Fréchet", which is also present in the already-migrated sibling packages).
  • git status confirms the only changed files are the two test 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. 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 written by Claude Code running as an unattended scheduled task. It mirrored the migration idiom from previously merged frechet packages, determined the minimum ULP bound empirically by measuring the maximum ULP difference across the fixture set and confirming the suite passes at 66 and fails at 65, and ran the package test suite and test linter locally.


@stdlib-js/reviewers


Generated by Claude Code

…ions

Replace the computed relative tolerance comparisons in the fixture loops
with `@stdlib/assert/is-almost-same-value` using the minimum required ULP
value (66).

Ref: #11352
@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 20, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Hello! 👋

We've noticed that you've been opening a number of PRs addressing good first issues. Thank you for your interest and enthusiasm!

Now that you've made a few contributions, we suggest no longer working on good first issues. Instead, we encourage you to prioritize cleaning up any PRs which have yet to be merged and then proceed to work on more involved tasks.

Not only does this ensure that other new contributors can work on things and get ramped up on all things stdlib, it also ensures that you can spend your time on more challenging problems. 🚀

For ideas for future PRs, feel free to search the codebase for TODOs and FIXMEs and be sure to check out other open issues on the issue tracker. Cheers!

@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

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