Skip to content

test: migrate stats/base/dists/betaprime/logcdf to ULP-based assertions - #15519

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-y6cunc
Sep 25, 2026
Merged

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

Conversation

@kgryte

@kgryte kgryte commented Sep 25, 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/betaprime/logcdf from relative tolerance testing to ULP difference testing, replacing the delta/tol/EPS comparisons in the fixture loops of test/test.logcdf.js and test/test.factory.js with t.strictEqual( isAlmostSameValue( y, expected[ i ], N ), true, 'returns expected value' ).
  • adds the @stdlib/assert/is-almost-same-value require and drops the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.

The ULP bound for each fixture is the measured minimum which passes over the full 1000-element fixture set (identical for the main export and the factory-created function):

Fixture Previous tolerance (main / factory) ULP bound
both_large 120.0 * EPS / 120.0 * EPS 24
large_alpha 120.0 * EPS / 10.0 * EPS 14
large_beta 400.0 * EPS / 400.0 * EPS 394

Each bound was tightened until one fixture case fails at N-1, so none can be lowered further:

both_large:  N=24  -> 1000/1000 pass | N=23  -> 999/1000 pass
large_alpha: N=14  -> 1000/1000 pass | N=13  -> 999/1000 pass
large_beta:  N=394 -> 1000/1000 pass | N=393 -> 999/1000 pass

Only the two test files are changed; no implementation, fixtures, or documentation were touched. The suite was run twice at the final bounds to confirm determinism (6055 assertions, 0 failures, identical both runs), and make eslint-tests TESTS_FILTER=".*/stats/base/dists/betaprime/logcdf/.*" is clean.

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 if ( y === expected[i] ) { ... } else { ... } split in the original fixture loops was collapsed into a single isAlmostSameValue assertion, matching the converted sibling package stats/base/dists/betaprime/cdf, since isAlmostSameValue already returns true for exactly equal values.

Note: the lint_editorconfig pre-commit task could not be run in the authoring environment, as editorconfig-checker is fetched from a GitHub release that the environment could not reach. The changed lines were verified manually against .editorconfig (tab indentation, LF endings, UTF-8, no new trailing whitespace, final newline present); the other applicable pre-commit tasks (lint_filenames, lint_javascript_tests) were run and pass.

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 as part of an automated, unattended run of the #11352 migration. It studied the already-converted sibling package stats/base/dists/betaprime/cdf to mirror the project's settled idiom, measured the minimum ULP bounds by binary search over the fixture sets, and verified them against the test runner.


@stdlib-js/reviewers


Generated by Claude Code

…ions

Replace relative tolerance comparisons with `isAlmostSameValue` assertions
in the `logcdf` and `factory` fixture loops. Each ULP bound is the measured
minimum which passes over the full fixture set:

-   `both_large`: 24 ULP
-   `large_alpha`: 14 ULP
-   `large_beta`: 394 ULP

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/betaprime/logcdf $\\color{green}251/251$
$\\color{green}+100.00\\%$
$\\color{green}27/27$
$\\color{green}+100.00\\%$
$\\color{green}3/3$
$\\color{green}+100.00\\%$
$\\color{green}251/251$
$\\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 25, 2026
@kgryte
kgryte marked this pull request as ready for review September 25, 2026 02:31
@kgryte
kgryte requested a review from a team September 25, 2026 02:31
@kgryte
kgryte merged commit e0366b2 into develop Sep 25, 2026
66 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-y6cunc branch September 25, 2026 02:32
@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 Sep 25, 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