test: migrate stats/base/dists/normal/quantile to ULP-based assertions - #15102
Draft
kgryte wants to merge 1 commit into
Draft
test: migrate stats/base/dists/normal/quantile to ULP-based assertions#15102kgryte wants to merge 1 commit into
stats/base/dists/normal/quantile to ULP-based assertions#15102kgryte wants to merge 1 commit into
Conversation
Replace computed relative tolerance assertions with `isAlmostSameValue` ULP comparisons in the fixture loops of `test.quantile.js`, `test.factory.js`, and `test.native.js`. The maximum observed ULP difference over the full 1000-point R fixture is 1024 for the main, factory, and native implementations alike, so all three files use a bound of 1024 ULP, which is the minimum bound which passes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D1uMqViBMp6d36XsPu1bQR
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/normal/quantilefrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.absandEPSimports along with thedelta/tolcomputations from the fixture loops intest/test.quantile.js,test/test.factory.js, andtest/test.native.js, replacing them witht.strictEqual( isAlmostSameValue( y, expected[ i ], 1024 ), true, 'returns expected value' );.ULP bound
All three files use a bound of 1024 ULP, which is the measured minimum.
The package has a single fixture (
test/fixtures/r/data.json, 1000 points). The maximum observed ULP difference over the full fixture set is1024for the main, factory, and native implementations alike (the worst case beingx = 0.5935935935935935,mu = -7,sigma = 29.6). The bound was tightened empirically: at1023each of the three files reports exactly one failing assertion, and at1024all pass. The native add-on was built locally so thattest/test.native.jswas actually exercised rather than skipped; the C implementation agrees with the JS implementation on every fixture value, so no separate bound is required.The previous tolerance was
2100.0 * EPS * abs( expected[ i ] ), so the new bound is a tightening.The suite was run twice at the final bound with identical results (4057 assertions, all passing), confirming determinism.
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
Only the three test files are modified; no source, documentation, or fixture changes.
The pre-commit
editorconfig-checkerhook could not run in this environment because the checker binary is downloaded from a GitHub release that this sandbox cannot reach. The relevant rules (LF line endings, UTF-8, tab indentation, no trailing whitespace, final newline) were verified manually against.editorconfiginstead.make lint-javascript-testspasses cleanly for the package.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code, running as an unattended scheduled task. The ULP bound was determined empirically by measuring the maximum ULP difference across the full fixture set and then bisecting to confirm the minimum passing value.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01D1uMqViBMp6d36XsPu1bQR
Generated by Claude Code