Repository navigation
test: migrate math/base/special/boxcox1p to ULP-based assertions - #14252
Merged
Merged
Conversation
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:
math/base/special/boxcox1pfrom relative tolerance testing (delta <= tol, wheretol = N * EPS * abs( expected )) to ULP difference testing using@stdlib/assert/is-almost-same-value, as proposed in [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.Changes are limited to
test/test.jsandtest/test.native.js. In each fixture loop, theif ( b === expected[ i ] ) { ... } else { ... }tolerance branch is replaced by a single assertion of the formthe now-unused
delta/tollocals and the@stdlib/math/base/special/absimport are removed, and the@stdlib/assert/is-almost-same-valueimport is added. The@stdlib/constants/float64/epsimport is retained, asEPSis still used when generating random inputs less than negative one. No test cases, fixtures, or assertion counts were added or removed.ULP bounds
Each bound is the measured minimum for its fixture, determined by computing the ULP difference for every fixture value and taking the maximum. Both test files use the same bounds, mirroring the existing convention for JavaScript/C test pairs.
medium_positive17.0 * EPS27small_positive4.0 * EPS4very_small1.0 * EPS0tiny1.0 * EPS0tiny_and_large_lambda3.0 * EPS2tiny_lambda1.0 * EPS1Each bound was confirmed tight by lowering it by one and re-running the suite; every reduction produces failures (
27→26: 1 failure,4→3: 7,2→1: 24,1→0: 187). Thevery_smallandtinyfixtures match exactly, so0is the minimum by construction. The full suite (11089 assertions) passes, and was run twice at the final bounds to confirm the results are deterministic.Note: the native add-on could not be compiled in the environment used to author this change, so
test/test.native.jswas verified to load and skip cleanly, but its bounds were not exercised locally and rely on CI. The C implementation is a direct port of the JavaScript implementation and calls stdlib's ownlog1p/expm1, so the same bounds are expected to hold.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
No.
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 and empirically measured the minimum ULP bounds.
@stdlib-js/reviewers
Generated by Claude Code