Skip to content

test: migrate stats/base/dists/invgamma/quantile to ULP-based assertions - #16004

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

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

Conversation

@kgryte

@kgryte kgryte commented Oct 9, 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/invgamma/quantile from relative tolerance (EPS-scaled delta <= tol) assertions to ULP-based assertions using @stdlib/assert/is-almost-same-value.

The conversion covers all three test files containing relative tolerance comparisons:

  • test/test.quantile.js
  • test/test.factory.js
  • test/test.native.js

Each ULP bound was tightened to the measured maximum ULP difference over the full Julia fixture set (1000 cases per fixture), so each bound is the minimum integer which still passes:

Fixture Previous tolerance Final ULP bound Measured minimum
both_large.json 200.0 * EPS * abs() 23 23
large_shape.json 100.0 * EPS * abs() 23 23
large_rate.json 50.0 * EPS * abs() 81 81

The same bounds apply to the JavaScript, factory, and native test files, as the JavaScript and C implementations return bit-identical values over these fixtures.

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.

Verification notes:

  • The bounds are minimal: lowering each by one (22 / 80) produces 4 failing assertions in each of the three test files.
  • The full suite was run twice at the final bounds with identical results (test.js 3/3, test.quantile.js 3019/3019, test.factory.js 3022/3022, test.native.js 3021/3021; 0 failures), confirming the bounds are deterministic and not sensitive to FMA/arch variation.
  • The native add-on was built locally so that test/test.native.js ran for real rather than being skipped.
  • ESLint reports no problems for the three changed files under etc/eslint/.eslintrc.tests.js.
  • Only test files are changed; no source, documentation, benchmark, or fixture files were touched.

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 authored by Claude Code running as an unattended scheduled task. It studied the idiom established in previously merged conversions (e.g. #15783, #15801, #15813), applied the mechanical test conversion, measured the per-fixture maximum ULP differences directly, and verified minimality and determinism as described above.


@stdlib-js/reviewers


Generated by Claude Code

…tions

Replace relative tolerance comparisons with `isAlmostSameValue` ULP
difference assertions in the test files for
`stats/base/dists/invgamma/quantile`.

The ULP bounds were tightened to the measured maximum ULP difference
over each full Julia fixture set:

-   `both_large`: 23 ULP
-   `large_shape`: 23 ULP
-   `large_rate`: 81 ULP

The same bounds apply to `test.quantile.js`, `test.factory.js`, and
`test.native.js`, as the JavaScript and C implementations return
identical values over the fixtures.

Ref: #11352

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/invgamma/quantile $\\color{green}307/307$
$\\color{green}+100.00\\%$
$\\color{green}24/24$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}307/307$
$\\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 11, 2026
@kgryte
kgryte marked this pull request as ready for review October 11, 2026 12:43
@kgryte
kgryte requested a review from a team October 11, 2026 12:43
@kgryte
kgryte merged commit 343ead9 into develop Oct 11, 2026
67 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-ow9xtl branch October 11, 2026 12:44
@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 Oct 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.

3 participants