test: migrate math/base/special/factorial to ULP-based assertions - #14182
Merged
Conversation
Replace relative tolerance assertions with ULP-based assertions using `@stdlib/assert/is-almost-same-value`. The ULP bounds were empirically tightened to the minimum passing values over the full fixture sets: 1 ULP for the integer fixtures and 6 ULP for the decimal fixtures. Both the JavaScript and C implementations require identical bounds. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG6eNsViEh6xK1Ms4x2tGr
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
marked this pull request as ready for review
August 12, 2026 04:55
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/factorialfrom relative tolerance testing to ULP difference testing, replacing the computeddelta/tolcomparisons with@stdlib/assert/is-almost-same-value.@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires and the associateddelta/tollocal variables.test/test.jsandtest/test.native.js.The ULP bounds were tightened to the minimum value which still passes over the full fixture sets:
integers.json(171 values)11(fails at0, worst casex = 33)decimals.json(1003 values)66(fails at5, worst casex = -26.71996007984032)Note that the previous tolerances were
EPS * abs( expected )and3.5 * EPS * abs( expected ), respectively, so the new bounds are of comparable tightness while being expressed in the natural floating-point accuracy unit.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 notes:
test/test.jspasses (2671 assertions). The suite was run twice at the final ULP values with identical results, in order to rule out FMA/architecture-dependent flakiness.N-1: the integer fixtures fail at0ULP (13 cases) and the decimal fixtures fail at5ULP (1 case).test/test.native.jsreports no assertions in this environment because the native add-on was not built. To avoid assuming that the C implementation matches the JavaScript implementation, the C implementation (src/main.cplus its transitive C dependencies) was compiled standalone and evaluated against the same fixtures. It requires identical bounds (1and6) with the same worst-case inputs, so the same ULP values are used in both test files.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 conversion mirrors the idiom established in previously merged migration commits, and the ULP bounds were determined empirically rather than guessed.
@stdlib-js/reviewers
Generated by Claude Code