Skip to content

test: migrate stats/base/dists/f/quantile to ULP-based assertions - #14554

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-f-quantile
Aug 23, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-f-quantile

Conversation

@kgryte

@kgryte kgryte commented Aug 23, 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/f/quantile from relative tolerance (EPS-scaled delta <= tol) assertions to ULP difference assertions using @stdlib/assert/is-almost-same-value.

Both test/test.quantile.js and test/test.factory.js are updated. The package has no test/test.native.js. The abs and EPS imports are no longer needed and have been removed, along with the now unused delta and tol locals. Only test files are changed; no source or fixture changes.

Each fixture-driven test block now asserts

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

The following ULP bounds are used, corresponding to the previous relative tolerances:

Fixture Test block Previous tolerance ULP bound
cpp/both_large.json large d1 and d2 20.0 * EPS 23
cpp/large_d1.json large d1 30.0 * EPS 20
cpp/large_d2.json large d2 20.0 * EPS 14

The same bounds apply to the corresponding test.factory.js blocks, as the measured maximum ULP difference is identical for the main and factory code paths.

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 ULP bounds above are the measured minimums over the full fixture sets (1000 values each), determined by computing, for every fixture value and for both the quantile and factory code paths, the smallest N for which isAlmostSameValue( actual, expected, N ) returns true, and taking the maximum over each fixture set. Each bound was confirmed to be tight: N - 1 fails for at least one value in the corresponding fixture set (worst-case index 431 for both_large, 419 for large_d1, 429 for large_d2).

The test suite was run twice at the final bounds; both runs pass identically (3021 assertions in test.quantile.js, 3024 in test.factory.js), so the bounds are not sensitive to run-to-run nondeterminism on this machine. eslint (using etc/eslint/.eslintrc.tests.js) reports no problems for either changed file.

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 authored by Claude Code as part of an automated batch migration for #11352. The conversion mirrors the idiom established in previously merged migration PRs (e.g. #14543, #14373), and the ULP bounds were measured empirically as described above rather than guessed.


@stdlib-js/reviewers


Generated by Claude Code

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

Copy link
Copy Markdown
Contributor

Coverage Report

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