test: migrate stats/base/dists/bradford/mean to ULP-based assertions - #15248
Merged
Merged
Conversation
Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016N9p5gjiRoDs5L3nHixpuB
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/bradford/meanfrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.delta/tolcomparisons intest/test.jsandtest/test.native.jswitht.strictEqual( isAlmostSameValue( y, expected[ i ], 9 ), true, 'returns expected value' ), adding the@stdlib/assert/is-almost-same-valuerequire and removing the now unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires.Final ULP constant:
9, for both fixture loops (test.jsandtest.native.js).The bound was tightened by starting high (
64) and lowering it to the minimum integer which still passes over the full fixture set. The Python fixture set contains 1000 cases, and the measured maximum ULP difference against the reference values was9for both the JavaScript and the C implementation:test.js(JS)test.native.js(C)The two implementations agree exactly: the per-case ULP distribution is identical for both, namely
9is the tightest passing bound: a bound of8fails one assertion in each file, and7fails two. The worst case isc = 0.2585585585585586, where the returned value is0.4808529480326162against a reference value of0.4808529480326157.The previous relative tolerance was
4.7 * EPS * abs( expected[ i ] ), which is a comparable accuracy budget (4.7 * EPSrelative error corresponds to roughly 9 ULP near the lower end of a binade).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
stats/base/dists/bradford/median, including the placement of the@stdlib/assert/is-almost-same-valuerequire.test/test.jsandtest/test.native.jseach pass 1006/1006 assertions at the final ULP bound. The suite was run twice at that bound with identical results, to rule out arch/FMA nondeterminism.node-gyp rebuild) so thattest/test.native.jsactually executed rather than being skipped, which is what confirms the9bound for the C implementation.make install-node-modulescould not complete in the development environment used here: the registry mirror reachable from this environment serveses-object-atomsonly up to1.1.1, while a transitive dependency requires^1.1.2, so npm reportsETARGET.tapeand the lint tooling were therefore provided out of tree, and the tests were run directly against the package. This is an environment limitation only; no dependency or lockfile in the repository was modified.etc/eslint/.eslintrc.tests.jsrule set (282 rules), with the in-repostdlibplugin's rules omitted because that plugin'sremark-lint-*dependency chain could not be installed in this environment. The result is 0 errors and 0 warnings. The rule set used was verified to be live by a negative control (an injected unused variable was correctly reported). Reviewers may wish to confirm the fullmake lintand the native tests on CI.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code, which selected the package, mirrored the idiom used by the already-migrated sibling package
stats/base/dists/bradford/median, measured the minimum passing ULP bound over the full fixture set for both the JavaScript and the C implementation, and verified the tests and linting locally.@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_016N9p5gjiRoDs5L3nHixpuB
Generated by Claude Code