Repository navigation
test: migrate stats/base/dists/laplace/stdev to ULP-based assertions - #14910
Conversation
Replace relative tolerance assertions with ULP difference assertions using `@stdlib/assert/is-almost-same-value`. The measured maximum ULP difference over the full fixture set is 1 for both the JavaScript and native implementations, so tests use a bound of 1 ULP. Resolves a part of #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M81QiKCao79ZzPSr4XXVrD
|
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. |
|
An automated check found potentially unrelated issue/PR references in this PR:
Why this matters: GitHub automatically closes issues referenced with What to do:
This assessment was generated by an AI model and is informational only. Generated by Claude Code |
Resolves a part of #11352.
Description
This pull request:
stats/base/dists/laplace/stdevfrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.delta/tol(EPS * abs( expected[i] )) comparisons intest/test.jsandtest/test.native.jswitht.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );, adding the@stdlib/assert/is-almost-same-valueimport and removing the now unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsimports.Final ULP constant:
1for bothtest/test.jsandtest/test.native.js.This is the measured minimum. Starting from a high bound and tightening, the maximum ULP difference over the full 1000-case Python fixture set (
test/fixtures/python/data.json) is exactly1for both the JavaScript and native implementations (551 of the 1000 cases are bit-for-bit exact). A bound of0fails 449 of the 1010 assertions, so1cannot be tightened further. The suite was run twice at the final bound with identical results, and the native addon was compiled locally so thattest/test.native.jsactually executed rather than being skipped:test/test.js: 1010 passing, 0 failingtest/test.native.js: 1011 passing, 0 failingOnly the two test files are changed.
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
The JavaScript and native implementations agree here (both compute a single multiplication by
sqrt(2)), so the same ULP bound applies to both files, consistent with other convertedstats/base/dists/*/stdevpackages.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 automated task. The tolerance-to-ULP conversion, the search for the minimum ULP bound, and the local test/lint verification were all performed by Claude Code.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01M81QiKCao79ZzPSr4XXVrD
Generated by Claude Code