test: migrate stats/incr/mgmean to ULP-based assertions - #15334
Planeshifter wants to merge 1 commit into
Conversation
Resolves a part of #11352 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sk7xXaJe3eAEqJbbExepdj
|
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/incr/mgmean'stest/test.jsfrom relative-tolerance (EPS-based) floating-point assertions to ULP-based assertions using@stdlib/assert/is-almost-same-value.delta/tolcomputations (and the now-unneededabs,EPSILON, andisnanrequires) in favor oft.strictEqual( isAlmostSameValue( actual, expected, N ), true, 'returns expected value' ), mirroring the idiom used in previously merged conversions for otherstats/incr/*packages (e.g.,stats/incr/mse,stats/incr/me).'the accumulator function computes a moving geometric mean incrementally': 2 ULPs (measured max observed diff: 2 ULPs).'if not provided an input value, the accumulator function returns the current geometric mean': 0 ULPs (exact match).'if provided \NaN`, the accumulated value is `NaN` for at least `W` invocations': **1** ULP (measured max observed diff: 1 ULP;isAlmostSameValuealso correctly treatsNaN/NaNpairs as the same value, so the previous explicitisnan` branch could be folded into the same assertion).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
Verified via:
41/41 assertions pass.
eslintrun against the changed file reports no issues. Onlytest/test.jswas changed; there is notest.native.jsfor this package.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written by Claude Code (an autonomous coding agent), which searched for a qualifying candidate package, studied prior merged conversions for the same idiom, performed the migration, and empirically determined the minimum ULP bounds described above by measuring actual ULP differences and confirming tightness/determinism through repeated test runs.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01Sk7xXaJe3eAEqJbbExepdj
Generated by Claude Code