Skip to content

test: migrate math/base/special/tanh to ULP-based testing#13652

Merged
kgryte merged 1 commit into
developfrom
philipp/ulp-math-base-special-tanh
Jul 25, 2026
Merged

test: migrate math/base/special/tanh to ULP-based testing#13652
kgryte merged 1 commit into
developfrom
philipp/ulp-math-base-special-tanh

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates math/base/special/tanh test cases from relative-tolerance-based assertions (EPS/abs/tol idiom) to ULP-based assertions using @stdlib/assert/is-almost-same-value in both test/test.js and test/test.native.js.
  • uses a measured minimum ULP bound of 2 for the main fixture dataset (fixtures/julia/data.json), which is the smallest integer value for which the full fixture set passes (verified: N=1 fails on 4 of 2003 cases; N=2 passes all).
  • the tiny_negative, tiny_positive, large_negative, and large_positive fixture sets are exact matches (0 ULP difference), so those loops use plain t.strictEqual( y, expected[ i ], 'returns expected value' ), matching the convention used in prior conversions (e.g. math/base/special/coth).
  • test suite was run twice at the final ULP bound to confirm deterministic results (no FMA/arch flakiness).

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.

Final ULP constant: 2 (main dataset only; other fixture sets are exact).

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 primarily by Claude Code, which studied issue #11352 and the prior converted packages (math/base/special/coth, math/base/special/atanh) to mirror the established idiom, then measured the minimum ULP bound agentically by running the test suite against candidate bounds.


@stdlib-js/reviewers


Generated by Claude Code

@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 Jul 25, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

No coverage information available.

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Jul 25, 2026
@kgryte
kgryte marked this pull request as ready for review July 25, 2026 10:10
@kgryte
kgryte requested a review from a team July 25, 2026 10:10
@kgryte
kgryte merged commit b0882ed into develop Jul 25, 2026
69 checks passed
@kgryte
kgryte deleted the philipp/ulp-math-base-special-tanh branch July 25, 2026 10:11
@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 Jul 25, 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