Repository navigation
test: migrate stats/base/snanstdevyc to ULP-based assertions - #15981
Conversation
Replaces relative tolerance assertions with ULP-based assertions using `@stdlib/number/float32/base/assert/is-almost-same-value`, mirroring the already migrated `stats/base/snanstdevpn` and `stats/base/snanstdevwd` packages. The ULP bound was tightened to the measured minimum of `1`. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KEjj6wCAAtneuEjf7cRxy9
|
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/snanstdevycfrom relative tolerance testing to ULP difference testing.Specifically, in
test/test.snanstdevyc.js,test/test.ndarray.js,test/test.snanstdevyc.native.js, andtest/test.ndarray.native.js:@stdlib/number/float32/base/assert/is-almost-same-valuerequire (the single-precision variant, as the package returns single-precision results), and removes the now unused@stdlib/math/base/special/absand@stdlib/constants/float32/epsrequires.deltaandtolcomputations, replacingt.strictEqual( delta <= tol, true, ... )witht.strictEqual( isAlmostSameValuef( v, expected, 1 ), true, 'returns expected value' ).This mirrors the already migrated sibling packages
stats/base/snanstdevpnandstats/base/snanstdevwd, which use the same idiom and the same ULP bound. Only test files are changed; no implementation, documentation, orpackage.jsonchanges were necessary. Exact comparisons (e.g., against0.0,NaN, and intest/test.js) were left as-is.Final ULP constant:
1(used in all four test files, for both the JavaScript and the native assertions).This is the measured minimum. The ULP difference between the returned value and the expected value was measured directly for each of the migrated assertions and is exactly
1in every case. Tightening further fails: at an ULP bound of0, 2 assertions fail in each of the four files; at1, all pass.Verification (locally, with the native add-on built so that the
*.native.jssuites actually run rather than skip):make test TESTS_FILTER=".*/stats/base/snanstdevyc/.*"→ 149 assertions, 149 passing, 0 failing.1with identical results, to confirm there is no FMA/architecture-dependent flakiness.etc/eslint/.eslintrc.tests.js) is clean on all four changed files, as is the filename lint.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
lint_editorconfigpre-commit check could not be run in this environment, as it attempts to download theeditorconfig-checkerbinary from GitHub and outbound access to that repository was unavailable. The changed files were instead verified manually against.editorconfig(LF line endings, UTF-8, tab indentation, 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. The agent selected the package, mirrored the migration idiom from the already migrated sibling packages, measured the minimum ULP bound empirically, and verified the tests and lint locally.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01KEjj6wCAAtneuEjf7cRxy9
Generated by Claude Code