Skip to content

test: migrate stats/base/dists/gamma/mean to ULP-based assertions - #15683

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-spuefz
Sep 30, 2026
Merged

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

Conversation

@kgryte

@kgryte kgryte commented Sep 30, 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/gamma/mean from relative tolerance assertions to ULP difference assertions, replacing the EPS-scaled delta <= tol checks in the fixture loops with isAlmostSameValue( y, expected[ i ], 1 ) in both test/test.js and test/test.native.js.
  • drops the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires and the associated delta/tol locals.

Final ULP constant: 1 (both test/test.js and test/test.native.js).

The bound was tightened from a high starting point down to the measured minimum. Over the full 200-value Julia fixture set (test/fixtures/julia/data.json), the maximum observed ULP difference is 1:

  • 0 ULP → 45 of 200 fixture cases fail.
  • 1 ULP → all cases pass.

So 1 is the minimum integer bound which passes, for both the JavaScript and the native implementation. Both implementations compute alpha / beta, which IEEE-754 rounds exactly, so the two produce bit-identical results across the fixture set (0 divergences measured) and share the same bound; no JS-vs-C split was required.

The package test suite (214 assertions per file) was run twice at the final bound, with the native add-on compiled so that test/test.native.js actually executes rather than skipping. Both runs were fully green, confirming there is no FMA/arch-dependent flakiness at 1 ULP.

Only the two test files are changed.

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 repository's editorconfig-checker pre-commit lint could not run in this environment, as the checker downloads its binary from the editorconfig-checker/editorconfig-checker GitHub releases, which is outside the network allowances available here. Formatting of the two changed files was instead verified manually (tab indentation, LF line endings, no trailing whitespace, single final newline). make lint-javascript-tests passes for both files.

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, running as an unattended scheduled task. It selected the package, mirrored the conversion idiom from already-merged PRs in the same family, measured the minimum ULP bound, and verified the tests and lint locally.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kzet3PR1rz8dncKtRLZ7eW


Generated by Claude Code

Replace the relative tolerance assertions in the fixture loops with
`@stdlib/assert/is-almost-same-value`, using the minimum required ULP
value (1) for both the JavaScript and native test suites.

Ref: #11352

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/gamma/mean $\\color{green}195/195$
$\\color{green}+100.00\\%$
$\\color{green}10/10$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}195/195$
$\\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 30, 2026
@kgryte
kgryte marked this pull request as ready for review September 30, 2026 10:56
@kgryte
kgryte requested a review from a team September 30, 2026 10:56
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 30, 2026
@kgryte
kgryte merged commit b333125 into develop Sep 30, 2026
82 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-spuefz branch September 30, 2026 10:57
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 30, 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