Repository navigation
test: migrate stats/base/dists/t/pdf to ULP-based assertions - #14564
Merged
Merged
Conversation
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
Member
|
An automated check found potentially unrelated issue/PR references in this PR:
Why this matters: GitHub automatically closes issues referenced with What to do:
This assessment was generated by an AI model and is informational only. Generated by Claude Code |
kgryte
marked this pull request as ready for review
August 25, 2026 00:15
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/t/pdffrom relative tolerance testing (delta <= tol, wheretol = {10.0,40.0} * EPS * abs( expected[ i ] )) to ULP difference testing using@stdlib/assert/is-almost-same-value.Changes are limited to test files:
test/test.pdf.jstest/test.factory.jstest/test.native.jsIn each of the four fixture loops in each file, the
if ( y === expected[i] ) { ... } else { delta/tol ... }branch was replaced withThe
@stdlib/assert/is-almost-same-valuerequire was added, and the now-unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires (along with thedeltaandtollocals) were removed. Unlike some sibling packages,EPSis not otherwise referenced in any of these three files, so it is removed from all three.test/test.jsis unchanged, as it contains no tolerance-based assertions.ULP constants
The bound differs per fixture, matching the per-fixture tolerances it replaces. The measured minimum ULP values are:
small_small.json10.0 * EPSlarge_small.json10.0 * EPSsmall_large.json40.0 * EPSlarge_large.json40.0 * EPSThe same four values apply to all three converted files (
test/test.pdf.js,test/test.factory.js,test/test.native.js).Each bound was tightened by measuring the exact worst-case ULP difference over the full Julia fixture set (4 fixtures × 1001 values = 4004 values). For every bound, exactly one assertion fails at
N-1, confirming each value is the minimum admissible integer bound:N-1small_small.jsonlarge_small.jsonsmall_large.jsonlarge_large.jsonNotably, the JavaScript implementation, the factory-generated function, and the native implementation return bit-identical results for all 4004 fixture values, so the same bounds are the measured minima for all three files.
For reference, the previous
10.0 * EPSand40.0 * EPSrelative tolerances correspond to roughly 10–20 ULP and 40–80 ULP respectively, so the new bounds are consistent with the tolerances they replace.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
Verification performed locally on
linux/x64, Node.js v22:make test TESTS_FILTER=".*/stats/base/dists/t/pdf/.*"— 12057 assertions passing, 0 failing (test.pdf.js4018,test.factory.js4018,test.js3,test.native.js4018). The native add-on was compiled locally vianode-gyp rebuild, so thetest.native.jsassertions actually executed rather than being skipped.make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/t/pdf/.*"— clean.One environment note: the
lint-editorconfig-filespre-commit hook could not run locally, as it downloads theeditorconfig-checkerbinary from a GitHub release that was not reachable from the sandbox. The changed files were instead checked by hand for tab indentation, absence of trailing whitespace, LF line endings, and a final newline — all clean, and consistent with the files' pre-existing formatting.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. The tolerance-to-ULP conversion mirrors the idiom of already-migrated packages in the same family (e.g.,
stats/base/dists/chi/pdfandstats/base/dists/gamma/pdf); the ULP bound search and the local verification runs were performed by the agent.@stdlib-js/reviewers
Generated by Claude Code