Repository navigation
test: migrate stats/base/dists/exponential/quantile to ULP-based assertions - #14706
Conversation
|
Hello! 👋 We've noticed that you've been opening a number of PRs addressing good first issues. Thank you for your interest and enthusiasm! Now that you've made a few contributions, we suggest no longer working on good first issues. Instead, we encourage you to prioritize cleaning up any PRs which have yet to be merged and then proceed to work on more involved tasks. Not only does this ensure that other new contributors can work on things and get ramped up on all things stdlib, it also ensures that you can spend your time on more challenging problems. 🚀 For ideas for future PRs, feel free to search the codebase for TODOs and FIXMEs and be sure to check out other open issues on the issue tracker. Cheers! |
Coverage Report
The above coverage report was generated for the changes in this PR. |
Resolves a part of #11352.
Description
This pull request:
stats/base/dists/exponential/quantilefrom relative-tolerance assertions (delta <= tol, withdelta = abs( y - expected[ i ] )andtol = 110.0 * EPS * abs( expected[ i ] )) to ULP-difference assertions using@stdlib/assert/is-almost-same-value.test/test.quantile.js,test/test.factory.js, andtest/test.native.js. (test/test.jscontains only smoke tests and is unchanged.)NaNparameters,poutside[0,1],+infinityforlambda, and negativelambda) and theInf/-Inffixture normalization.The ULP bound used is:
test/test.quantile.jsfixtures/r/data.json(1000 cases)test/test.factory.jsfixtures/r/data.json(1000 cases)test/test.native.jsfixtures/r/data.json(1000 cases)172is the measured minimum: starting fromN = 64and searching upward/tightening,N = 172passes over the full fixture set whileN = 171fails on exactly one fixture entry (p = 0.001001001001001001,lambda = 38.7, where the returned value0.000025878613361486335differs from the R expected value0.000025878613361486918by exactly 172 ULP). The suite was run twice at the finalNto confirm deterministic passing (1013 assertions per file, all passing on both runs, no FMA/arch variation).Because the native add-on is not built in this environment,
test/test.native.jsis skipped locally and its bound could not be measured by running that file directly. Instead, the C implementation was compiled standalone against its resolved C dependency closure (math/base/special/ln,math/base/assert/is-nan,number/float64/base/get-high-word,number/float64/base/set-high-word) and evaluated over all 1000 fixture inputs: its results are bit-for-bit identical to the JavaScript implementation for every input, so the same bound of172applies to all three files.Linting was checked over the changed files and is clean. The only files changed are the three test files.
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
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code: the assistant mechanically converted the tolerance-based assertions to
isAlmostSameValue, agentically searched for the minimum ULP bound, verified that the C implementation matches the JavaScript implementation bit-for-bit over the fixture set, confirmed determinism across two full runs, and ran the local lint and test suites before submitting.@stdlib-js/reviewers
Generated by Claude Code