test: migrate stats/base/dists/poisson/mgf to ULP-based assertions - #14499
Merged
Conversation
Replaces the relative-tolerance assertions in the `stats/base/dists/poisson/mgf` test files with ULP-based assertions using `@stdlib/assert/is-almost-same-value`. The measured maximum ULP difference over the full Julia fixture set is 0, so the assertions use a bound of 0 ULP. Ref: #11352 Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WqLxC1CYmvaZzPBjqzzu6o
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves a part of #11352.
Description
This pull request:
@stdlib/stats/base/dists/poisson/mgffrom relative-tolerance assertions to ULP-based assertions using@stdlib/assert/is-almost-same-value, per the guidance in [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.test/test.mgf.js,test/test.factory.js, andtest/test.native.jsto mirror the idiom used in previously converted packages (e.g.stats/base/dists/normal/mgf,stats/base/dists/normal/mean,stats/base/dists/weibull/cdf).EPS * abs( expected[ i ] )tolerance loops in all three files witht.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' ).@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires.test/test.jsonly asserts on the main export and the attachedfactorymethod and thus required no changes.The tightest ULP bound was determined empirically by measuring, for every fixture value, the minimum
Nfor whichisAlmostSameValue( actual, expected, N )returnstrue, and taking the maximum over the full Julia fixture set (3000 values across thesmall,medium, andlargefixtures):test/test.mgf.js: N = 0 ULP (measured maximum ULP difference: 0 across all three fixture groups).test/test.factory.js: N = 0 ULP (measured maximum ULP difference: 0 across all three fixture groups).test/test.native.js: N = 0 ULP, mirroring the JavaScript bound, consistent with previously merged conversions.All 3000 fixture values match the Julia reference bit-for-bit, so 0 is both the measured maximum and the tightest bound expressible, and the previous tolerance branch was never taken.
test/test.js,test/test.mgf.js, andtest/test.factory.jswere each run twice at the finalN = 0(3, 3008, and 3009 assertions, respectively; all passing) to confirm the bound is deterministic. Linting with the repository'setc/eslint/.eslintrc.tests.jsconfiguration is clean for all four test files, and only the three 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
The native add-on could not be built in the environment used to author this PR, so
test/test.native.jswas exercised in skipped form only and itsN = 0bound is mirrored from the JavaScript measurement rather than measured against the C implementation. Reviewers may wish to confirm the native tests pass atN = 0in an environment with add-ons built. This is the main reason the PR is opened as a draft.Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code (Anthropic) running as an unattended scheduled task. The conversion mirrors the exact idiom used in previously merged ULP migrations authored by the PR author (e.g. #14302, #14472), and the ULP bound was measured empirically against the existing Julia fixtures for the JavaScript implementation.
@stdlib-js/reviewers
Generated by Claude Code