Repository navigation
test: migrate stats/base/dists/beta/median to ULP-based assertions - #14174
Merged
Merged
Conversation
Replaces the computed relative tolerance (`15.0 * EPS * abs( expected )`) in the fixture loop with an ULP-based assertion using `@stdlib/assert/is-almost-same-value`. The ULP bound was tightened to the measured minimum over the full fixture set (15 ULP; 14 fails). Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WT1k4EJXMZQLG6FfPXP8kR
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/beta/medianfrom relative tolerance testing to ULP difference testing, as proposed in [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.delta/tolcomputation (tol = 15.0 * EPS * abs( expected[ i ] )) in the fixture loop withisAlmostSameValue( y, expected[ i ], 15 ).@stdlib/assert/is-almost-same-valuerequire and removes the now unused@stdlib/constants/float64/epsand@stdlib/math/base/special/absrequires.The ULP bound was tightened to the measured minimum of
15ULP. Over the full fixture set (1000 cases fromtest/fixtures/julia/data.json), the maximum observed ULP difference is exactly 15, attained atalpha = 17.553104872605317,beta = 17.707711393619853, where the implementation returns0.4977657564823537versus an expected0.4977657564823529. A bound of14fails that one case, so15is the tightest passing integer bound. The bound was found by starting at64and stepping down (64→32→16→15pass;14fails, 1 assertion). The test file was run twice at the final bound with identical results (1014 passing assertions, no failures), so the result is deterministic in this environment.This package has no
test/test.native.jsand no native implementation, so onlytest/test.jsis affected. No implementation files were modified; the only change is to the single test file.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
make install-node-modulescould not complete in the environment used to author this change: the available registry mirror has noes-object-atoms@^1.1.2, which a transitive dependency requires. The package tests were therefore run with a standalonetapeinstallation andNODE_PATHpointed atlib/node_modules, and the repository linter could not be run (its ESLint plugin/config chain depends on the full dev dependency tree). The changed file was checked with a reduced ESLint ruleset (unused variables, undefined references, indentation, quotes, semicolons) and is clean; the diff mirrors the idiom of the already-merged conversions in this family (e.g.stats/base/dists/f/mode,stats/base/dists/lognormal/variance,stats/base/dists/pareto-type1/kurtosis). Please confirm lint in CI.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. The conversion mirrors already-merged migrations in the same family, and the 15 ULP bound was determined empirically by measuring the minimum passing ULP difference over every fixture rather than assumed.
@stdlib-js/reviewers
Generated by Claude Code