Repository navigation
test: migrate math/base/special/gammaln to ULP-based assertions - #14357
Merged
Merged
Conversation
Replaces relative-tolerance comparisons with `isAlmostSameValue` in both the JavaScript and native test suites. The ULP bounds were measured over the full fixture sets and tightened to the minimum passing values: 2 ULP for the positive-integer fixtures and 15 ULP for the decimal-value fixtures. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Ae9H3xMMYKcipgJot7h18
kgryte
marked this pull request as ready for review
August 17, 2026 22:26
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:
math/base/special/gammalnfrom relative-tolerance (EPS-scaled) assertions 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.test/test.jsandtest/test.native.js.@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires from both test files.ULP bounds
Each fixture group was measured against its expected values and the bound tightened to the minimum integer that still passes:
data1/expected1(171 values)21.2 * EPS * abs(expected)22data2/expected2(1000 values)1.1e4 * EPS * abs(expected)1515The bounds are minimal: lowering them to
1and14respectively produces 9 failing assertions (8 in the positive-integer set, 1 in the decimal set). At the final bounds the suite passes 1184/1184, and was run twice with identical results to rule out non-determinism.The same bounds are used in
test.native.js. To measure rather than assume this, the C implementation (src/main.cplus its transitive C dependencies) was compiled standalone and evaluated over both fixture sets: it is bit-for-bit identical to the JavaScript implementation across all 1171 fixture points (max ULP difference between the two implementations is0), so the native bounds are also exactly2and15.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 native test suite could not be executed in the authoring environment because the native add-on was not built there (
test.native.jsskips when the add-on is absent). The native ULP bounds were instead derived by compiling and evaluating the C implementation directly, as described above. Confirmation from CI, where the add-on is built, would be welcome.Other
Only the two test files are changed; the implementation and fixtures are untouched.
Note on verification environment:
make install-node-modulescould not complete in the authoring environment (the configured npm registry has noes-object-atoms@^1.1.2, which a transitive dependency requires), so the standardmakelint/test targets were unavailable. As substitutes,tapewas installed standalone to run the suite, ESLint was run against the repository's own rule set frometc/eslint/ruleswith theetc/eslint/.eslintrc.tests.jsoverrides applied (clean, and cross-checked against an already-merged converted package as a control), and the EditorConfig rules were validated directly. Full CI verification is still needed.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. It selected the package, studied already-merged conversions to match the established idiom, applied the conversion, and measured and tightened the ULP bounds empirically.
@stdlib-js/reviewers
Generated by Claude Code