Skip to content

test: migrate stats/base/dists/gumbel/quantile to ULP-based assertions - #15761

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

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

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.quantile.js, test/test.factory.js, and test/test.native.js are replaced with isAlmostSameValue( y, expected[ i ], 0 ) 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. test/test.js contains no tolerance-based assertions and is therefore unmodified.

The ULP bound is the measured minimum over each full fixture set:

Fixture Measured max ULP diff ULP bound
fixtures/julia/positive_mean.json 0 0
fixtures/julia/negative_mean.json 0 0
fixtures/julia/large_variance.json 0 0

Each fixture set contains 1000 cases. Every value returned by all three implementations under test (lib/main.js, lib/factory.js, and the C implementation in src/main.c) is bit-identical to the Julia reference value across all 3000 cases, so the measured minimum is 0 ULP and the same bound is used in all three test files. Because 0 is the floor for an integer ULP bound, there is no tighter value to check.

This is consistent with the implementations: both the JS and the C versions compute mu - beta*ln( -ln( p ) ) using stdlib's own ln, and no divergence was observed.

Note that the previous bounds were 1.0 * EPS in test.quantile.js and test.factory.js and 50.0 * EPS in test.native.js; the uniform 0 ULP bound is tighter than all three, and in particular substantially tightens the native tests.

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 test TESTS_FILTER=".*/stats/base/dists/gumbel/quantile/.*" is green, with the native add-on built locally so that test/test.native.js is actually exercised rather than skipped (3018 + 3015 + 3 + 3015 assertions passing). The suite was run twice at the final bound with identical results both times, so the 0 ULP bound is not sensitive to FMA contraction on this platform.
  • make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/gumbel/quantile/.*" is clean.
  • The idiom mirrors the already-converted sibling packages stats/base/dists/gumbel/logpdf and stats/base/dists/lognormal/quantile.

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 bound empirically and ran the tests and linter.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01M9PdYMm2xpfAF4AN4QoAfg


Generated by Claude Code

@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 1, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/gumbel/quantile $\\color{green}296/296$
$\\color{green}+100.00\\%$
$\\color{green}23/23$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}296/296$
$\\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 2, 2026
@kgryte
kgryte marked this pull request as ready for review October 2, 2026 01:13
@kgryte
kgryte requested a review from a team October 2, 2026 01:13
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Oct 2, 2026
@kgryte
kgryte merged commit 25751e9 into develop Oct 2, 2026
82 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-kmf062 branch October 2, 2026 01:14
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Oct 2, 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