Skip to content

test: migrate stats/base/dists/bradford/cdf to ULP-based assertions - #14401

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-bradford-cdf
Aug 19, 2026
Merged

test: migrate stats/base/dists/bradford/cdf to ULP-based assertions#14401
kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-bradford-cdf

Conversation

@kgryte

@kgryte kgryte commented Aug 19, 2026

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

Details:

  • Package converted: stats/base/dists/bradford/cdf (test/test.cdf.js, test/test.factory.js, and test/test.native.js; test/test.js contains no tolerance math and is unchanged).

  • Final ULP constants, one per fixture set, identical across all three test files:

    fixture set previous tolerance final ULP bound
    small_c 3.0 * EPS 4
    medium_c 2.2 * EPS 4
    large_c 1.9 * EPS 3
  • Measured minimum: starting from a loose bound and tightening, the values above are the smallest integers under which the full 1000-value fixture set passes for each set. Lowering any of them by one produces 4 failures in that fixture set in each test file, so none can be tightened further. Of the 1000 values per set, 644 / 739 / 909 respectively are already bit-for-bit exact.

  • Determinism: the suite was run twice at the final bounds, with the native add-on compiled locally so test/test.native.js actually executed rather than being skipped. Both runs: 3015 / 3018 / 3 / 3015 assertions across test.cdf.js, test.factory.js, test.js, and test.native.js, all passing.

  • Linting is clean for all three files under etc/eslint/.eslintrc.tests.js, and the only changed files are the three test files.

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 conversion mirrors the idiom already used in the same family (e.g., stats/base/dists/negative-binomial/cdf): the fixture loop drops the exact-vs-tolerance branch entirely in favor of a single t.strictEqual( isAlmostSameValue( y, expected[ i ], N ), true, 'returns expected value' ); assertion. The expected[i] !== null guard in test/test.native.js is left in place.

The same bounds apply to test/test.native.js because the JavaScript and C implementations return bit-identical results at every one of the 3000 fixture points, which was verified directly before choosing the bounds.

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, running unattended as a scheduled task, which selected the package, mirrored the conversion idiom from previously merged conversions, and empirically determined and verified the minimum ULP bounds.


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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/bradford/cdf $\\color{green}299/299$
$\\color{green}+100.00\\%$
$\\color{green}25/25$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}299/299$
$\\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 19, 2026
@kgryte
kgryte marked this pull request as ready for review August 19, 2026 07:22
@kgryte
kgryte requested a review from a team August 19, 2026 07:22
@kgryte
kgryte merged commit 63391c6 into develop Aug 19, 2026
66 checks passed
@kgryte
kgryte deleted the kgryte/ulp-stats-base-dists-bradford-cdf branch August 19, 2026 07:22
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Aug 19, 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