test: migrate stats/base/dists/pareto-type1/kurtosis to ULP-based assertions - #14119
Merged
Conversation
…ssertions Replaces the relative-tolerance comparisons in `test.js` and `test.native.js` with `isAlmostSameValue` ULP-difference assertions. Both the JavaScript and C implementations are bit-exact against the Julia fixtures over all 1000 cases, so the ULP bound is tightened to 0 (previously 1.0*EPS and 2.0*EPS relative tolerances, respectively). Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VRnhaYbnH5rDnzzpfGqT3o
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.
Description
This pull request:
stats/base/dists/pareto-type1/kurtosisfrom relative-tolerance (EPS-scaled) test assertions to ULP-based assertions using@stdlib/assert/is-almost-same-value, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.Changes are confined to
test/test.jsandtest/test.native.js. In both files, theabs/EPSrequires are replaced byisAlmostSameValue, thedelta/tollocals are dropped, and the exact-vs-tolerance branch in the fixture loop collapses to a single assertion:Final ULP constants and measured minimum
test/test.js1.0 * EPS * abs( expected )00test/test.native.js2.0 * EPS * abs( expected )00Both bounds were tightened to the measured minimum of 0 ULP. Starting from a high bound and lowering it, the per-fixture minimum ULP distance was measured across the full fixture set (1000 cases in
test/fixtures/julia/data.json): both the JavaScript implementation and the C implementation reproduce the Julia reference values bit-exactly for every case, so no non-zero bound is required.0is the tightest representable bound, so no further lowering is possible.The native addon was compiled locally so that
test.native.jswas actually exercised rather than skipped (1017 assertions passing, 0 skipped). Both suites were run repeatedly at the final bound and passed identically each time, indicating no FMA/architecture-dependent variation. The excess kurtosis is a closed-form rational expression inalpha, which is consistent with the observed bit-exactness.Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
The C implementation measured bit-exact against the fixtures on this machine (Linux x86-64, gcc), so both bounds are set to
0. If the project would rather keep a small non-zero margin intest.native.jsto absorb possible FMA contraction on other toolchains/architectures, I'm happy to raise that one bound.Other
Linting note:
make lintcould not be run in this environment becausemake install-node-modulesfails during dependency resolution (npm error notarget No matching version found for es-object-atoms@^1.1.2), which is unrelated to this change. The two changed files were instead checked with a standalone ESLint pass for unused variables and related issues, and came back clean; the diff otherwise mirrors the shape of already-merged conversions such asstats/base/dists/halfnormal/stdevandstats/base/dists/weibull/logcdf. CI should be treated as the authoritative lint check here.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 studied previously merged ULP conversions to match the established idiom, applied the test changes, compiled the native addon, and measured the minimum passing ULP bound empirically over the full fixture set.
@stdlib-js/reviewers
Generated by Claude Code