Repository navigation
test: migrate stats/base/dists/frechet/quantile to ULP-based assertions - #15574
Merged
Merged
Conversation
…ions Replace relative tolerance comparisons in the Julia fixture loops with `isAlmostSameValue` ULP difference assertions. The JavaScript and C implementations both return bit-identical values to the fixtures across all three fixture sets, so the measured minimum ULP bound is 0. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EfjwehoSMdN3GyYaYExW7M
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/frechet/quantilefrom relative tolerance testing to ULP difference testing, replacing thedelta/tolcomparisons in the Julia fixture loops withisAlmostSameValue( y, expected[ i ], N )assertions.test/test.quantile.js,test/test.factory.js, andtest/test.native.js. Only test files are changed; no implementation, documentation, or fixture changes.The ULP bounds are the measured minimums over the full fixture sets (each set has 1000 values). The implementation returns bit-identical values to the Julia fixtures for every value in every set, so the minimum is
0and no lower bound exists:large_shape.json1.0 * EPS * abs( expected[ i ] )300.0 * EPS * abs( expected[ i ] )00is the floor)large_scale.json1.0 * EPS * abs( expected[ i ] )1500.0 * EPS * abs( expected[ i ] )00is the floor)both_large.json1.0 * EPS * abs( expected[ i ] )4100.0 * EPS * abs( expected[ i ] )00is the floor)The native add-on was built locally so that
test/test.native.jsactually ran rather than being skipped. The C implementation returns bit-identical values to the JavaScript implementation for every fixture value (both computem + s*pow( -ln( p ), -1/alpha )via@stdlib/math/base/special/powand@stdlib/math/base/special/ln, so neither depends on the system libm), and the factory-created function returns bit-identical values to the main export. Accordingly,test/test.native.jsuses the same bounds as the JavaScript tests, which tightens the previous native tolerances considerably.make test TESTS_FILTER=".*/stats/base/dists/frechet/quantile/.*"passes (9065 assertions across the four test files, no skips and no failures), and was run twice at the final bounds with identical results.make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/frechet/quantile/.*"is 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
The previous native tolerances (
300/1500/4100EPS) were far looser than the JavaScript ones (1.0EPS). Since the C implementation measures bit-identical to both the JavaScript implementation and the fixtures here, this PR drops the native bounds to0alongside the JavaScript ones. If those looser native tolerances were originally chosen to accommodate a platform not represented here, please say so and the native bounds can be relaxed.Other
The idiom mirrors the already-migrated sibling packages
stats/base/dists/cosine/quantileandstats/base/dists/frechet/pdf.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code, which performed the mechanical test migration, measured the minimum ULP bounds against the fixture sets, and verified the tests and linting locally.
@stdlib-js/reviewers
Generated by Claude Code