Repository navigation
test: migrate stats/base/dists/geometric/quantile to ULP-based assertions - #16078
Merged
Merged
Conversation
…rtions Replace relative tolerance assertions with ULP difference assertions using `@stdlib/assert/is-almost-same-value`. The quantile function returns non-negative integers, and both the JavaScript and C implementations reproduce the Julia fixture values exactly, so the minimum required ULP value is `0`. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KQ4E7FPN4az358SNsfFhCG
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
marked this pull request as ready for review
October 12, 2026 13:42
5 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves a part of #11352.
Description
This pull request:
stats/base/dists/geometric/quantilefrom relative tolerance testing to ULP difference testing.delta/tolcomparisons withisAlmostSameValue( y, expected[ i ], 0 )intest/test.quantile.js,test/test.factory.js, andtest/test.native.js, adding the@stdlib/assert/is-almost-same-valueimport and removing the now-unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsimports.ULP bounds
The final ULP constant is
0for all six migrated fixture loops (smallpand largep, across the main, factory, and native tests).This value was tightened empirically rather than assumed. Starting from a high bound, the minimum required ULP value was measured per fixture case over the full fixture set (1000 cases in
small_p.jsonand 1000 cases inlarge_p.json) for the JavaScript implementation, the factory-generated function, and the compiled C implementation. The measured maximum required ULP difference was0in every case, i.e. all three implementations reproduce the Julia reference values exactly.This is expected, as the quantile function of a geometric distribution returns non-negative integers which are exactly representable in double-precision. It also preserves the strictness of the previous assertions, as the former
1.0 * EPS * abs( expected[ i ] )tolerance was already below one integer unit for the fixture magnitudes involved.The full package suite was run twice at the final bound, with identical results each time (6037 assertions, all passing, no failures), confirming the bound is deterministic and not sensitive to FMA/architecture differences.
Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
No.
Other
Verification notes:
make test TESTS_FILTER=".*/stats/base/dists/geometric/quantile/.*"passes (run twice; 6037 assertions, 0 failures).make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/geometric/quantile/.*"is clean.make install-node-addons NODE_ADDONS_PATTERN=stats/base/dists/geometric/quantile) so thattest/test.native.jswas actually exercised rather than skipped; its 2011 assertions pass against the C implementation.editorconfigpre-commit hook could not run in this environment, as it attempts to download a binary from a repository outside the session's allowed scope. Compliance was instead checked by hand (LF endings, tab indentation, UTF-8, no trailing whitespace, final newline present).Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code running as an unattended scheduled task. It selected the package, studied the idiom used by previously merged conversions in the same family, applied the test migration, measured the minimum ULP bound empirically over the full fixture set, and verified tests and linting locally.
@stdlib-js/reviewers
Generated by Claude Code