test: migrate stats/base/dists/rayleigh/logcdf to ULP-based assertions - #14322
Merged
Conversation
Replaces relative tolerance comparisons with `isAlmostSameValue` checks in the test fixture loops. The JavaScript and native implementations both reproduce the Julia reference values exactly over all three fixture files, so the ULP bound was tightened to `0`. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E1SM9ZH1ZA2Gamaz998sP9
Contributor
Coverage ReportNo coverage information available. |
kgryte
marked this pull request as ready for review
August 16, 2026 06:25
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/rayleigh/logcdffrom EPS-scaled relative tolerance comparisons 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 limited to test files:
test/test.logcdf.jstest/test.factory.jstest/test.native.jsIn each fixture loop, the
if ( y === expected[i] ) { ... } else { delta/tol ... }branch was replaced withand the now unused
@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires (along with thedeltaandtollocals) were removed.Final ULP constant:
0(all fixture loops, in both the JavaScript and native test files).The bound was tightened agentically: starting from a high value and lowering it to the minimum integer that still passes. The measured minimum is
0for every fixture file — the JavaScript implementation, the factory-generated function, and the native implementation each reproduce the Julia reference values bit-exactly across all 3000 fixture values (1000 each insmall_scale.json,medium_scale.json, andlarge_scale.json).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 measured minimum is
0ULP, which is what is committed here. If reviewers would prefer a small amount of headroom (e.g.,1) to guard against platform-specific differences on architectures not exercised locally, that is an easy change.Other
Verification performed locally on
linux/x64, Node.js v22:test/test.js— 3 passingtest/test.logcdf.js— 3011 passingtest/test.factory.js— 3013 passingtest/test.native.js— 3011 passing (the native add-on was compiled locally vianode-gyp rebuild, so these assertions actually executed rather than being skipped)The full suite was run twice at the final ULP value with identical results, confirming no FMA/arch-dependent flakiness locally.
make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/rayleigh/logcdf/.*"passes cleanly, and the only files changed are the three test files.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code, which mirrored the conversion idiom from already-migrated packages (e.g.,
stats/base/dists/rayleigh/pdfandstats/base/dists/arcsine/logcdf) and empirically determined the minimum ULP bound over the full fixture set.@stdlib-js/reviewers
Generated by Claude Code