Skip to content

test: migrate math/base/special/gamma1pm1 to ULP-based assertions - #13994

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-gamma1pm1
Aug 7, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-gamma1pm1

Conversation

@kgryte

@kgryte kgryte commented Aug 7, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates the tests for math/base/special/gamma1pm1 from relative tolerance (EPS-based) assertions to ULP difference assertions using @stdlib/assert/is-almost-same-value.
  • updates both test/test.js and test/test.native.js, removing the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.

The ULP bounds were tightened to the measured minimum which still passes over the full fixture sets:

Test case Fixtures Previous tolerance ULP bound
small negative numbers fixtures/cpp/small_negative.json (1000 values) 5.0 * EPS * abs( expected ) 3
small positive numbers fixtures/cpp/small_positive.json (1000 values) 2.0 * EPS * abs( expected ) 2

The same bounds apply to both the JavaScript and the native (C) implementations, so test.js and test.native.js use identical values.

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?

No.

Other

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

Notes on how the bounds were determined and verified:

  • For each fixture value, the minimum N for which isAlmostSameValue( actual, expected, N ) returns true was computed; the bound above is the maximum such N over the full fixture set.
  • The bounds are tight: lowering the small negative bound to 2 produces 1 failing assertion, and lowering the small positive bound to 1 produces 29 failing assertions.
  • The native add-on was built locally (make install-node-addons NODE_ADDONS_PATTERN=gamma1pm1) so that test/test.native.js actually ran rather than being skipped.
  • make test TESTS_FILTER=".*/math/base/special/gamma1pm1/.*" was run twice at the final bounds, with identical results each time (2691 passing in test.js, 2680 passing in test.native.js, 0 failing).
  • make lint-javascript-tests TESTS_FILTER=".*/math/base/special/gamma1pm1/.*" is clean.

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 helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was written by Claude Code, following the idiom established in previously merged conversions (e.g., math/base/special/sqrt1pm1, math/base/special/asec, math/base/special/powm1). The ULP bounds were measured empirically against the fixture sets rather than guessed.


@stdlib-js/reviewers


Generated by Claude Code

Replaces relative tolerance assertions in the `gamma1pm1` fixture loops
with `isAlmostSameValue` ULP-based assertions. The ULP bounds are the
measured minimums over the full fixture sets: 3 ULP for the small
negative fixtures and 2 ULP for the small positive fixtures, for both
the JavaScript and native implementations.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L8y1oQRpySabKgjBMumaWs
@stdlib-bot stdlib-bot added Math Issue or pull request specific to math functionality. Good First PR A pull request resolving a Good First Issue. labels Aug 7, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/gamma1pm1 $\\color{green}551/551$
$\\color{green}+100.00\\%$
$\\color{green}62/62$
$\\color{green}+100.00\\%$
$\\color{green}6/6$
$\\color{green}+100.00\\%$
$\\color{green}551/551$
$\\color{green}+100.00\\%$

The above coverage report was generated for the changes in this PR.

@kgryte
kgryte marked this pull request as ready for review August 7, 2026 06:14
@kgryte
kgryte requested a review from a team August 7, 2026 06:14
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 7, 2026
@kgryte kgryte added the Tests Pull requests specifically adding tests. label Aug 7, 2026
@kgryte
kgryte merged commit d894f00 into develop Aug 7, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-gamma1pm1 branch August 7, 2026 06:15
@kgryte kgryte removed the Needs Review A pull request which needs code review. label Aug 7, 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.

4 participants