Repository navigation
test: migrate stats/base/dists/weibull/kurtosis to ULP-based assertions - #15516
Merged
Merged
Conversation
…ions Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HSKJcyAaUxty3NwkcujtAR
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/weibull/kurtosisfrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.Specifically, in both
test/test.jsandtest/test.native.js:@stdlib/assert/is-almost-same-valuerequire and removes the now unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires.deltaandtoldeclarations and the computed tolerance logic (tol = 1.5e6 * EPS * abs( expected[ i ] )).y === expected[i]/t.ok( delta <= tol, ... )branch with a singlet.strictEqual( isAlmostSameValue( y, expected[ i ], 1292760 ), true, 'returns expected value' );.ULP constant:
1292760(same value intest/test.jsandtest/test.native.js).This is the measured minimum. Starting from a high bound and tightening over the full 500-case Julia fixture set,
1292760is the smallest integer for which every case passes:129275812927591292760The worst case is
k = 19.094404848351264,lambda = 17.223983273178845, where the implementation returns1.2261287913603294against an expected1.226128791073279(a relative difference of ~2.3e-10, consistent with the previous1.5e6 * EPSrelative tolerance).The JavaScript and C implementations require the identical bound (both measured at
1292760), so a single constant is used in both test 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
The required bound here is large (
1292760), inherited from the package's pre-existing1.5e6 * EPSrelative tolerance rather than introduced by this change. It is within the range of bounds already used elsewhere in the codebase after migration. Happy to revisit if maintainers would prefer the underlying accuracy of the implementation be addressed first, in which case this migration could wait.Other
Verification performed:
make test TESTS_FILTER=".*/stats/base/dists/weibull/kurtosis/.*"— 514/514 passing intest/test.js.node-gyp rebuild) so thattest/test.native.jswas actually exercised rather than skipped — also 514/514 passing.make eslint-tests TESTS_FILTER=".*/stats/base/dists/weibull/kurtosis/.*"— clean.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 idiom established in previously merged migrations (notably the sibling
stats/base/dists/weibull/skewness, #15484, andstats/base/dists/geometric/mean, #15491, for theEPS-require removal), applied the same mechanical transformation here, and determined the ULP bound empirically by measuring the required ULP distance across the full fixture set rather than by guessing and re-running.@stdlib-js/reviewers
Generated by Claude Code