Skip to content

test: migrate stats/base/dists/beta/entropy to ULP-based assertions - #14558

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

kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-beta-entropy

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:

ULP bound: 384 (both test/test.js and test/test.native.js), the measured minimum over the fixture set.

The bound was determined empirically rather than assumed. Starting from a high bound and bisecting downward over isAlmostSameValue across the full Julia fixture set (1000 values), the minimum admissible bound is exactly 384: 401 of the 1000 returned values are bit-identical to the Julia reference, and the largest ULP difference among the remainder is 384, attained at alpha = 10.003231427967421, beta = 13.875047324311737. Lowering the bound to 383 was confirmed to fail (3 failing assertions out of 1014), so the bound cannot be tightened further. The suite was then run twice at the final bound with identical results (1014/1014 passing per suite in each run), so the bound is not sensitive to run-to-run variation.

The previous relative tolerance was 250.0 * EPS * abs( expected[ i ] ), which corresponds to roughly 250–500 ULP depending on where the expected value falls within its binade, so 384 sits within the prior accuracy budget rather than loosening it.

To confirm that 384 is also correct for the C implementation, the native addon was compiled locally via make install-node-addons NODE_ADDONS_PATTERN="stats/base/dists/beta/entropy" and test/test.native.js was executed against the real addon rather than being skipped: it likewise passes all 1014 assertions at 384 ULP, twice, and bisecting the native results independently also yields 384 as the minimum. This matches the sibling conversions in this family (weibull/entropy, normal/entropy, logistic/entropy), which likewise use a single bound across both suites.

Only the two test files are modified; no implementation, fixture, or documentation changes are included.

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.

Notes on local verification:

  • make install-node-modules initially failed in this environment because the local npm cache held a stale packument for es-object-atoms, causing es-object-atoms@^1.1.2 to resolve as nonexistent. Clearing the npm cache resolved it; no repository files were involved.
  • make lint-editorconfig-files (run via the pre-commit hook) could not execute because the editorconfig-checker binary download is blocked in this environment. The changed files were instead checked manually for indentation (tabs), trailing whitespace, line endings (LF), and final newline, and match the surrounding files exactly.
  • make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/beta/entropy/.*" reports no problems for either 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 running as an unattended scheduled task. It studied previously merged conversions under #11352 (including the weibull/entropy and rayleigh/cdf siblings) to match the established idiom, applied the migration, measured the minimum ULP bound empirically against the fixtures for both the JavaScript and the locally compiled C implementation, and verified that the tests pass and that the files lint cleanly.


@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/beta/entropy $\\color{green}202/202$
$\\color{green}+100.00\\%$
$\\color{green}10/10$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}202/202$
$\\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 11:44
@kgryte
kgryte requested a review from a team August 23, 2026 11:44
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 23, 2026
@kgryte
kgryte merged commit 093792b into develop Aug 23, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-stats-base-dists-beta-entropy branch August 23, 2026 11:45
@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.

3 participants