Repository navigation
test: migrate stats/base/dists/hypergeometric/kurtosis to ULP-based assertions - #15679
Merged
Merged
Conversation
… assertions Replace relative tolerance assertions with ULP difference assertions using `@stdlib/assert/is-almost-same-value`. Both the JavaScript and C implementations reproduce all 100 Julia fixture values exactly, so the minimum required ULP bound is 0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rm5v6R5JFbwVZMqaYZWitD
Contributor
Coverage ReportNo coverage information available. |
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/hypergeometric/kurtosisfrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.delta/tolcomputation intest/test.jsandtest/test.native.jswithisAlmostSameValue( y, expected[ i ], 0 ), adding the@stdlib/assert/is-almost-same-valuerequire and removing the now unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires.Final ULP constant:
0in bothtest/test.jsandtest/test.native.js.The bound was tightened empirically rather than assumed. Starting from a high bound and bisecting per fixture, the maximum ULP difference across all 100 Julia fixture values was measured as
0for both the JavaScript and the C implementation — that is, both reproduce every fixture value bit-for-bit, so0is the measured minimum (and the smallest admissible value, sincemaxULPis a nonnegative integer).This is consistent with the implementations: both
lib/main.jsandsrc/main.cevaluate the excess kurtosis using only IEEE 754 basic arithmetic (+,-,*,/), with no transcendental calls, so exactly-rounded results are expected.Only the two test files are changed; the implementation, fixtures, and docs are untouched. The previous assertions already took the exact-equality branch for every fixture (
tolwas1.0 * EPS * abs( expected[ i ] )), so this migration preserves the existing strictness.Verification performed:
make test TESTS_FILTER=".*/stats/base/dists/hypergeometric/kurtosis/.*"— 120/120 passing intest/test.jsand 120/120 passing intest/test.native.js. The C addon was built locally, so the native tests genuinely ran rather than being skipped. The suite was run twice at the final ULP value with identical results.make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/hypergeometric/kurtosis/.*"— clean.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 idiom follows the already-converted sibling package
stats/base/dists/hypergeometric/skewness, which has the same signature and fixture layout.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written by Claude Code, running unattended as a scheduled task. The ULP bound was measured empirically by bisecting the per-fixture ULP difference against the package's own fixtures, not guessed; the resulting test suites were then executed twice at the final bound to confirm determinism.
@stdlib-js/reviewers
Generated by Claude Code