Repository navigation
test: migrate stats/base/dists/gumbel/quantile to ULP-based assertions - #15761
Merged
Merged
Conversation
Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M9PdYMm2xpfAF4AN4QoAfg
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
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/gumbel/quantilefrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.The computed
delta/tolcomparisons in the fixture loops oftest/test.quantile.js,test/test.factory.js, andtest/test.native.jsare replaced withisAlmostSameValue( y, expected[ i ], 0 )assertions, and the now-unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires 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.jscontains no tolerance-based assertions and is therefore unmodified.The ULP bound is the measured minimum over each full fixture set:
fixtures/julia/positive_mean.jsonfixtures/julia/negative_mean.jsonfixtures/julia/large_variance.jsonEach fixture set contains 1000 cases. Every value returned by all three implementations under test (
lib/main.js,lib/factory.js, and the C implementation insrc/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 ownln, and no divergence was observed.Note that the previous bounds were
1.0 * EPSintest.quantile.jsandtest.factory.jsand50.0 * EPSintest.native.js; the uniform 0 ULP bound is tighter than all three, and in particular substantially tightens the native tests.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
make test TESTS_FILTER=".*/stats/base/dists/gumbel/quantile/.*"is green, with the native add-on built locally so thattest/test.native.jsis 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.stats/base/dists/gumbel/logpdfandstats/base/dists/lognormal/quantile.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
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