Repository navigation
test: migrate stats/base/dists/chisquare/quantile to ULP-based assertions - #15801
Conversation
…rtions Replace computed relative-tolerance comparisons with ULP-based assertions using `@stdlib/assert/is-almost-same-value`. The ULP bound (402) is the measured minimum which passes over the full 5000-point Julia fixture set for both the main export and the factory method. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJUnEuXaPBeT6twr7w8ziC
|
Hello! 👋 We've noticed that you've been opening a number of PRs addressing good first issues. Thank you for your interest and enthusiasm! Now that you've made a few contributions, we suggest no longer working on good first issues. Instead, we encourage you to prioritize cleaning up any PRs which have yet to be merged and then proceed to work on more involved tasks. Not only does this ensure that other new contributors can work on things and get ramped up on all things stdlib, it also ensures that you can spend your time on more challenging problems. 🚀 For ideas for future PRs, feel free to search the codebase for TODOs and FIXMEs and be sure to check out other open issues on the issue tracker. Cheers! |
Coverage Report
The above coverage report was generated for the changes in this PR. |
Description
This pull request:
stats/base/dists/chisquare/quantilefrom computed relative-tolerance comparisons to ULP-based assertions, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.if ( y === expected[i] ) { ... } else { delta = abs( y - expected[i] ); tol = 250.0 * EPS * abs( expected[i] ); t.ok( delta <= tol, ... ); }branches intest/test.quantile.jsandtest/test.factory.jswith a singlet.strictEqual( isAlmostSameValue( y, expected[ i ], 402 ), true, 'returns expected value' );assertion.@stdlib/assert/is-almost-same-valuerequire and removes the now-unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires, along with thedelta/toldeclarations.ULP bound
402(used in bothtest/test.quantile.jsandtest/test.factory.js).402is the measured minimum. It was determined by bisecting the ULP bound over the complete 5000-pointtest/fixtures/julia/decimal_decimal.jsonfixture set for both the main export and the function returned byfactory. Both code paths have the same worst-case point (fixture index4815).N = 402the suite reports10029passing assertions and0failures; atN = 401exactly2assertions fail (the worst-case point in each of the two files).N = 402with identical results, confirming the bound is not sensitive to FMA/arch variation on this platform.250.0 * EPS * abs( expected[i] ), so a bound in the low hundreds of ULP is consistent with the accuracy this suite previously accepted.Verification
node_modules/.bin/tape lib/node_modules/@stdlib/stats/base/dists/chisquare/quantile/test/*.js→# tests 10029/# pass 10029/# ok(three consecutive runs).make eslint-tests TESTS_FILTER=".*/stats/base/dists/chisquare/quantile/.*"→ clean, exit0.Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
402ULP is on the larger end of the bounds used elsewhere in the repo, but it is the tightest value that passes the existing fixtures and is in line with the suite's previous250 * EPSrelative tolerance. If reviewers would prefer the underlying accuracy be investigated rather than codified, happy to split that out into a separate issue.Other
stats/base/dists/erlang/quantile,stats/base/dists/gumbel/quantile): an inline numeric ULP literal rather than a named constant, and the standardized'returns expected value'assertion message.pre-commitEditorConfig hook could not run in this environment, because it downloads theeditorconfig-checkerbinary from a GitHub repository outside this session's allowed scope. EditorConfig conformance was therefore checked manually for both files: LF line endings, UTF-8, tab indentation, no trailing whitespace, and a single final newline.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written by Claude Code running as an unattended scheduled task. It selected the package, mirrored the conversion idiom from previously merged PRs in the same family, measured the minimum ULP bound by bisection over the fixture set, and verified the tests and linting.
@stdlib-js/reviewers
Generated by Claude Code