Skip to content

test: migrate stats/base/dists/beta/stdev to ULP-based assertions - #15091

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-beta-stdev
Sep 8, 2026
Merged

test: migrate stats/base/dists/beta/stdev to ULP-based assertions#15091
kgryte merged 1 commit into
developfrom
kgryte/ulp-beta-stdev

Conversation

@kgryte

@kgryte kgryte commented Sep 8, 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/beta/stdev from relative tolerance testing to ULP difference testing.
  • replaces the delta/tol comparisons in test/test.js and test/test.native.js with @stdlib/assert/is-almost-same-value, adds the corresponding require, and removes the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps imports.
  • uses a ULP bound of 2 in both test/test.js and test/test.native.js. This is the measured minimum over the full 1000-case Python fixture set: a bound of 1 fails for one case (alpha: 7.512224992944586, beta: 16.738584643513867), while 2 passes for all cases. The suite was run twice at the final bound to confirm determinism.
  • makes no changes outside of the two test files.

Note on the native tests: the JavaScript and C implementations perform an identical sequence of operations (sqrt( ( alpha * beta ) / ( alpha + beta + 1.0 ) ) / ( alpha + beta )) with a correctly rounded sqrt, and the compiled C implementation was verified to return bit-identical results to the JavaScript implementation across all 1000 fixture cases, giving the same measured minimum of 2.

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.

No.

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, which selected the package, mirrored the conversion idiom used in already-migrated packages, and measured the minimum passing ULP bound.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_017Yzm1pYd69FheDzXXPPnR4


Generated by Claude Code

Replaces relative-tolerance comparisons in `test/test.js` and
`test/test.native.js` with `@stdlib/assert/is-almost-same-value`.
The ULP bound was tightened to the measured minimum of `2`; a bound
of `1` fails for one fixture case.

Ref: #11352

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/beta/stdev $\\color{green}201/201$
$\\color{green}+100.00\\%$
$\\color{green}10/10$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}201/201$
$\\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 Sep 8, 2026
@kgryte
kgryte marked this pull request as ready for review September 8, 2026 06:28
@kgryte
kgryte requested a review from a team September 8, 2026 06:28
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 8, 2026
@kgryte
kgryte merged commit 1c770d4 into develop Sep 8, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-beta-stdev branch September 8, 2026 06:28
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 8, 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