Repository navigation
test: migrate stats/base/dists/discrete-uniform/cdf to ULP-based assertions - #14311
Merged
Merged
Conversation
…sertions Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ACAqYrd3QLCADw4S7aHPrm
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:
stats/base/dists/discrete-uniform/cdffrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.Changes are confined to the package's test files (
test/test.cdf.js,test/test.factory.js,test/test.native.js):@stdlib/assert/is-almost-same-valuerequire and removes the now unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires.delta/toldeclarations and theif ( y === expected[i] ) { ... } else { ... }tolerance branch.t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );.No implementation, fixture, or documentation files are touched, and no test cases were added, removed, or otherwise altered.
test/test.jscontains no tolerance-based assertions and is left unchanged.ULP bound
All nine converted assertion loops use an ULP value of
1, which is the measured minimum.The bound was measured rather than guessed: computing the minimum ULP value for which
isAlmostSameValuereturnstruefor each computed value and its expected fixture value, across the full fixture set (small_range.json,medium_range.json,large_range.json; 1000 values each, 3000 total) yields a maximum observed ULP difference of1for the main export, for the function returned byfactory, and for the native C implementation. Running the suite with the bound lowered to0fails (123 failing assertions), confirming1is the tightest value that passes.Verification:
test/test.cdf.js,test/test.factory.js,test/test.native.js— 3006–3011 assertions each, 9037 in total, all passing.test/test.native.jsactually executed rather than being skipped; the C implementation evaluates the same expression as the JavaScript implementation (( floor( x ) - a + 1.0 ) / ( b - a + 1.0 )), and measures the same 1 ULP maximum.etc/eslint/.eslintrc.tests.js) reports no problems for the three changed files.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
Opened as a draft.
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 the previously merged ULP migrations (in particular the sibling package
stats/base/dists/weibull/cdf, #14281, which has an identical test structure) to match the established idiom, applied the mechanical test conversion, and empirically measured the minimum ULP bound and ran the test suite to verify it.@stdlib-js/reviewers
Generated by Claude Code