Skip to content

test: migrate math/base/special/fast/asinh to ULP-based assertions - #14079

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-fast-asinh
Aug 8, 2026
Merged

test: migrate math/base/special/fast/asinh to ULP-based assertions#14079
kgryte merged 1 commit into
developfrom
kgryte/ulp-fast-asinh

Conversation

@kgryte

@kgryte kgryte commented Aug 8, 2026

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

Only the two test files are modified; no implementation or fixture changes.

ULP bounds

Bounds were tightened agentically: starting from 64 and lowering to the minimum integer which still passes over the full fixture set. The measured maximum ULP difference per fixture set is:

Fixture set Test Previous tolerance Final ULP bound Measured max ULP
smaller (n=503) [-0.8,0.8] (odd function) 50.0 * EPS 79 79
small_negative (n=503) [-1.0,-0.8] 1.5 * EPS 2 2
small_positive (n=503) [0.8,1.0] 1.5 * EPS 2 2
medium_negative (n=503) [-3.0,-1.0] 2.0 * EPS 2 2
medium_positive (n=503) [1.0,3.0] 2.0 * EPS 2 2
large_positive (n=503) [3.0,28.0] 1.0 * EPS 1 1
large_negative (n=503) [-28.0,-3.0] 1.0 * EPS 1 1
larger_positive (n=503) [28.0,100.0] 1.0 * EPS 1 1
larger_negative (n=503) [-100.0,-28.0] 1.0 * EPS 1 1

The bounds are minimal: decrementing every bound by one (79 → 78, 2 → 1, 1 → 0) yields 192 failing assertions, with at least one failure in each of the nine fixture loops.

The larger bound on the smaller fixture set is expected for this package: fast/asinh evaluates ln( x + sqrt( x*x + 1 ) ) directly, so for small |x| the argument to ln is close to 1 and cancellation dominates the error. The worst case is at the smallest magnitude in that set (x = -0.006374501992031873). This mirrors the previous 50.0 * EPS relative tolerance, which was already loosened for that interval relative to the others.

The JavaScript and native implementations were measured independently and produce identical maximum ULP differences (79 / 2 / 2 / 2 / 2 / 1 / 1 / 1 / 1), so test.js and test.native.js use the same bounds.

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.

Verification performed:

  • test/test.js: 4536 assertions passing; run twice at the final bounds with identical results (no FMA/arch nondeterminism observed).
  • test/test.native.js: the native addon was built locally via node-gyp rebuild, so these tests ran for real rather than being skipped — 4536 assertions passing, also run twice.
  • ESLint clean against etc/eslint/.eslintrc.tests.js (the config the eslint-tests target uses for test files).
  • git diff --check clean; tab indentation and trailing-newline conventions preserved.
  • The now-unused @stdlib/math/base/special/abs require was removed from both files; @stdlib/constants/float64/eps is retained because EPS is still used by the underflow test.

Environment note: the editorconfig pre-commit hook could not run in this environment because downloading the editorconfig-checker binary is blocked, so the relevant checks (indentation style, trailing whitespace, final newline, line endings) were verified manually instead.

Opened as a draft pending CI.

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 authored by Claude Code running as an unattended scheduled task. It studied prior converted packages (including the already-migrated sibling math/base/special/fast/acosh, #14004) to match the established idiom, applied the conversion, and empirically searched for the minimum passing ULP bound for each fixture set.


@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 Aug 8, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/fast/asinh $\\color{green}178/178$
$\\color{green}+100.00\\%$
$\\color{green}11/11$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}178/178$
$\\color{green}+100.00\\%$

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

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

3 participants