Skip to content

test: migrate stats/base/dists/beta/median to ULP-based assertions - #14174

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-beta-median
Aug 11, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-beta-median

Conversation

@kgryte

@kgryte kgryte commented Aug 11, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

The ULP bound was tightened to the measured minimum of 15 ULP. Over the full fixture set (1000 cases from test/fixtures/julia/data.json), the maximum observed ULP difference is exactly 15, attained at alpha = 17.553104872605317, beta = 17.707711393619853, where the implementation returns 0.4977657564823537 versus an expected 0.4977657564823529. A bound of 14 fails that one case, so 15 is the tightest passing integer bound. The bound was found by starting at 64 and stepping down (64 → 32 → 16 → 15 pass; 14 fails, 1 assertion). The test file was run twice at the final bound with identical results (1014 passing assertions, no failures), so the result is deterministic in this environment.

This package has no test/test.native.js and no native implementation, so only test/test.js is affected. No implementation files were modified; the only change is to the single test file.

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.

make install-node-modules could not complete in the environment used to author this change: the available registry mirror has no es-object-atoms@^1.1.2, which a transitive dependency requires. The package tests were therefore run with a standalone tape installation and NODE_PATH pointed at lib/node_modules, and the repository linter could not be run (its ESLint plugin/config chain depends on the full dev dependency tree). The changed file was checked with a reduced ESLint ruleset (unused variables, undefined references, indentation, quotes, semicolons) and is clean; the diff mirrors the idiom of the already-merged conversions in this family (e.g. stats/base/dists/f/mode, stats/base/dists/lognormal/variance, stats/base/dists/pareto-type1/kurtosis). Please confirm lint in CI.

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

This PR was authored by Claude Code running as an unattended scheduled task. The conversion mirrors already-merged migrations in the same family, and the 15 ULP bound was determined empirically by measuring the minimum passing ULP difference over every fixture rather than assumed.


@stdlib-js/reviewers


Generated by Claude Code

Replaces the computed relative tolerance (`15.0 * EPS * abs( expected )`)
in the fixture loop with an ULP-based assertion using
`@stdlib/assert/is-almost-same-value`. The ULP bound was tightened to the
measured minimum over the full fixture set (15 ULP; 14 fails).

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WT1k4EJXMZQLG6FfPXP8kR
@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 11, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/beta/median $\\color{green}125/125$
$\\color{green}+100.00\\%$
$\\color{green}8/8$
$\\color{green}+100.00\\%$
$\\color{green}1/1$
$\\color{green}+100.00\\%$
$\\color{green}125/125$
$\\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 11, 2026
@kgryte
kgryte marked this pull request as ready for review August 11, 2026 23:41
@kgryte
kgryte requested a review from a team August 11, 2026 23:41
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 11, 2026
@kgryte
kgryte merged commit a9cfa23 into develop Aug 11, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-beta-median branch August 11, 2026 23:42
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 11, 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