Skip to content

test: migrate math/base/special/gammaln to ULP-based assertions - #14357

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-8y5pqt
Aug 17, 2026
Merged

kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-8y5pqt

Conversation

@kgryte

@kgryte kgryte commented Aug 17, 2026

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

ULP bounds

Each fixture group was measured against its expected values and the bound tightened to the minimum integer that still passes:

Test Fixtures Previous tolerance Final ULP bound Measured max ULP
positive integers data1 / expected1 (171 values) 21.2 * EPS * abs(expected) 2 2
decimal values data2 / expected2 (1000 values) 1.1e4 * EPS * abs(expected) 15 15

The bounds are minimal: lowering them to 1 and 14 respectively 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.c plus 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 is 0), so the native bounds are also exactly 2 and 15.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

The native test suite could not be executed in the authoring environment because the native add-on was not built there (test.native.js skips 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

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Only the two test files are changed; the implementation and fixtures are untouched.

Note on verification environment: make install-node-modules could not complete in the authoring environment (the configured npm registry has no es-object-atoms@^1.1.2, which a transitive dependency requires), so the standard make lint/test targets were unavailable. As substitutes, tape was installed standalone to run the suite, ESLint was run against the repository's own rule set from etc/eslint/rules with the etc/eslint/.eslintrc.tests.js overrides 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

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance.

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

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 kgryte added the Tests Pull requests specifically adding tests. label Aug 17, 2026
@kgryte
kgryte marked this pull request as ready for review August 17, 2026 22:26
@kgryte
kgryte requested a review from a team August 17, 2026 22:26
@stdlib-bot stdlib-bot added the Good First PR A pull request resolving a Good First Issue. label Aug 17, 2026
@kgryte
kgryte merged commit 8dcc957 into develop Aug 17, 2026
48 of 50 checks passed
@stdlib-bot stdlib-bot added the Math Issue or pull request specific to math functionality. label Aug 17, 2026
@kgryte
kgryte deleted the claude/great-brahmagupta-8y5pqt branch August 17, 2026 22:27
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Math Issue or pull request specific to math functionality. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants