test: migrate stats/base/dists/bradford/quantile to ULP-based assertions - #14923
Merged
Conversation
…tions Replace the relative tolerance comparisons in `test/test.quantile.js`, `test/test.factory.js`, and `test/test.native.js` with `isAlmostSameValue` ULP difference assertions. The measured minimum ULP bounds are `5` (small `c`), `6` (medium `c`), and `7` (large `c`), which hold identically for both the JavaScript and native implementations. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012wtya3dXa2SDCVsefgMHKb
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
marked this pull request as ready for review
September 3, 2026 03:04
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/quantilefrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.delta/tol(3.2 * EPS * abs( expected[i] )and4.8 * EPS * abs( expected[i] )) comparisons intest/test.quantile.js,test/test.factory.js, andtest/test.native.jswitht.strictEqual( isAlmostSameValue( y, expected[ i ], N ), true, 'returns expected value' );, adding the@stdlib/assert/is-almost-same-valueimport and removing the now unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsimports.Final ULP constants (identical across all three test files):
small_c.json5medium_c.json6large_c.json7These are the measured minimums. Starting from a high bound and tightening, the maximum ULP difference over the full 1000-case-per-group Python fixture set is exactly
5,6, and7respectively. Each bound was verified to be minimal: lowering any one of them by a single ULP produces failing assertions (1, 1, and 2 failures respectively). The bounds hold identically for the JavaScript and native implementations, so the same values apply to all three files.The suite was run twice at the final bounds with identical results, and the native addon was compiled locally so that
test/test.native.jsactually executed rather than being skipped:test/test.js: 3 passing, 0 failingtest/test.quantile.js: 3011 passing, 0 failingtest/test.factory.js: 3013 passing, 0 failingtest/test.native.js: 3011 passing, 0 failingtest/test.jscontains only export smoke tests and is unchanged. Theexpected[i] !== nullguards intest/test.native.jsare preserved. Only the three test files containing tolerance math 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
No.
Other
The conversion mirrors the sibling package
stats/base/dists/bradford/cdf, which uses the same three-fixture structure and per-fixture-group ULP bounds.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 automated task. The tolerance-to-ULP conversion, the search for the minimum ULP bounds, and the local test/lint verification were all performed by Claude Code.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_012wtya3dXa2SDCVsefgMHKb
Generated by Claude Code