Repository navigation
test: migrate stats/base/dists/frechet/skewness to ULP-based assertions - #14531
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/frechet/skewnessfrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.delta/tolcomparisons intest/test.jsandtest/test.native.jswitht.strictEqual( isAlmostSameValue( y, expected[ i ], 244 ), true, 'returns expected value' );, adding the@stdlib/assert/is-almost-same-valuerequire and dropping the now unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires. The existingexpected[i] !== nullguard (Julia emitsnullfor parameter combinations having infinite skewness) is preserved.ULP bound:
244(bothtest/test.jsandtest/test.native.js), the measured minimum over the fixture set.The bound was determined empirically rather than assumed: for every fixture, the minimum admissible bound was found by bisection over
isAlmostSameValue, and the maximum over the full Julia fixture set (44 of 100 values are non-nulland therefore compared) is exactly244. The worst case isalpha = 4.750849820273925,s = 3.748713063341589(y = 3.837909707867179vs. expected3.8379097078670705). Re-running the suite at243fails that single case, confirming244cannot be tightened further. The JS suite was then run twice at the final bound with identical results (59/59 passing), so the bound is not sensitive to run-to-run variation.The previous relative tolerance was
140.0 * EPS, which is of comparable magnitude (140 * EPScorresponds to roughly140–280ULP depending on where a value falls within its binade), so this is not a loosening of the prior accuracy budget.The native addon is not built in this environment, so
test/test.native.jsis skipped locally. To confirm that244is also correct for the C implementation,src/main.cwas compiled directly against its transitive C dependency closure (math/base/special/gamma,math/base/special/pow, etc.) and evaluated over the same fixtures; its maximum ULP difference is likewise244, attained on the same input. This matches the sibling conversions in this family (frechet/variance,frechet/kurtosis), which likewise use a single bound across both suites.Only the two test files are modified; no implementation, fixture, or documentation changes are included.
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 running as an unattended scheduled task. It studied previously merged conversions under #11352 (including the
frechet/varianceandfrechet/kurtosissiblings) to match the established idiom, applied the migration, measured the minimum ULP bound empirically against the fixtures (including a direct compilation of the C source to cover the skipped native suite), and verified that the tests pass and that the files lint cleanly.@stdlib-js/reviewers