Skip to content

test: migrate stats/base/dists/betaprime/logpdf to ULP-based assertions - #15736

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-wutit9
Oct 1, 2026
Merged

kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-wutit9

Conversation

@kgryte

@kgryte kgryte commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

The computed delta/tol comparisons in the fixture loops of test/test.logpdf.js, test/test.factory.js, and test/test.native.js are replaced with isAlmostSameValue( y, expected[ i ], <ulp> ) assertions, and the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires are dropped in favor of @stdlib/assert/is-almost-same-value. No other test cases were touched; the exact comparisons elsewhere in these files are unchanged.

The ULP bounds are the measured minimums over each full fixture set (bisected per fixture file, and confirmed by observing a failure at N-1):

Fixture ULP bound
fixtures/julia/both_large.json 32768
fixtures/julia/large_alpha.json 384
fixtures/julia/large_beta.json 8192

The same three minimums hold for all three implementations under test (lib/main.js, lib/factory.js, and lib/native.js), so test.native.js uses the same bounds as test.logpdf.js. The suite was run twice at the final bounds, with identical results both times (3023 + 3 + 3020 + 3020 assertions passing, native addon built locally so that test.native.js was not skipped).

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 lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/betaprime/logpdf/.*" is clean.
  • The idiom mirrors the already-converted sibling packages stats/base/dists/betaprime/logcdf and stats/base/dists/beta/logpdf.

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 also measured the minimum ULP bounds empirically and ran the tests and linter.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01PoVHr24hud4A2KStzaRMPX

…ions

Replace the relative tolerance comparisons in the fixture loops with
`@stdlib/assert/is-almost-same-value` checks. The ULP bounds are the
measured minimums for each fixture set (32768 for `both_large`, 384 for
`large_alpha`, and 8192 for `large_beta`), and are identical for the
main, factory, and native implementations.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PoVHr24hud4A2KStzaRMPX
@stdlib-bot stdlib-bot added Good First PR A pull request resolving a Good First Issue. Statistics Issue or pull request related to statistical functionality. labels Oct 1, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/betaprime/logpdf $\\color{green}342/342$
$\\color{green}+100.00\\%$
$\\color{green}25/25$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}342/342$
$\\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 Oct 1, 2026
@kgryte
kgryte marked this pull request as ready for review October 1, 2026 10:36
@kgryte
kgryte requested a review from a team October 1, 2026 10:36
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Oct 1, 2026
@kgryte
kgryte merged commit 493f958 into develop Oct 1, 2026
86 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-wutit9 branch October 1, 2026 10:38
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Oct 1, 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