Skip to content

test: migrate math/base/special/fast/acosh to ULP-based assertions - #14004

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

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

Conversation

@kgryte

@kgryte kgryte commented Aug 7, 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
medium_positive ([1.0,3.0], n=507) [1.0,3.0] 6.0 * EPS 8 8
large_positive ([3.0,28.0], n=507) [3.0,28.0] 1.0 * EPS 1 1
larger_positive ([28.0,100.0], n=507) [28.0,100.0] 1.0 * EPS 1 1
huge_positive (n=1003) huge values 1.0 * EPS 1 1

The bounds are minimal: lowering the [1.0,3.0] bound to 7 fails, and lowering any of the 1 bounds to 0 (exact equality) fails.

The larger bound on [1.0,3.0] is expected for this package: fast/acosh evaluates ln( x + sqrt(x+1)*sqrt(x-1) ) directly, so cancellation in x-1 near x = 1 dominates the error there. This mirrors the previous 6.0 * EPS relative tolerance, which was already loosened for that interval.

The JavaScript and native implementations were measured independently and produce identical maximum ULP differences (8 / 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: 3527 assertions passing; run twice at the final bounds with identical results (no FMA/arch nondeterminism observed).
  • test/test.native.js: native addon was built locally via node-gyp rebuild, so these tests ran for real rather than being skipped — 3527 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.

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/acosh) 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

Replaces computed relative tolerance comparisons with
`isAlmostSameValue` ULP difference assertions. The ULP bounds are the
measured minimums over the full fixture sets 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_01UViLFYQZDZTmUPew8Kdh85
@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/fast/acosh $\\color{green}162/162$
$\\color{green}+100.00\\%$
$\\color{green}10/10$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}162/162$
$\\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 7, 2026
@kgryte
kgryte marked this pull request as ready for review August 7, 2026 06:56
@kgryte
kgryte requested a review from a team August 7, 2026 06:56
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 7, 2026
@kgryte
kgryte merged commit a831cc5 into develop Aug 7, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-fast-acosh branch August 7, 2026 06:57
@stdlib-bot stdlib-bot 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.

3 participants