Skip to content

test: migrate math/base/special/ellipk to ULP-based assertions - #13943

Draft
kgryte wants to merge 1 commit into
developfrom
claude/gallant-bardeen-dpazht
Draft

test: migrate math/base/special/ellipk to ULP-based assertions#13943
kgryte wants to merge 1 commit into
developfrom
claude/gallant-bardeen-dpazht

Conversation

@kgryte

@kgryte kgryte commented Aug 5, 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/ellipk from relative tolerance testing (delta <= tol, where tol = C * EPS * abs( expected[ i ] )) to ULP difference testing using @stdlib/assert/is-almost-same-value.
  • applies the migration to both test/test.js and test/test.native.js.
  • removes the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires from both test files.

Each assertion uses the t.strictEqual( isAlmostSameValue( y, expected[ i ], N ), true, 'returns expected value' ) shape, where N is inlined per test body, matching the idiom used in previously merged conversions.

The ULP bounds are the measured minimum over each full fixture set (4000 cases per fixture):

Test body Fixture Previous tolerance ULP bound
medium positive values fixtures/cpp/medium_positive.json 25.0 * EPS 25
values close to positive unity fixtures/cpp/close_to_unity.json 8000.0 * EPS 12065
medium negative values fixtures/cpp/medium_negative.json 1.5 * EPS 2
large negative values fixtures/cpp/large_negative.json 1e9 * EPS 204773163

Notes on how the bounds were determined:

  • The ULP difference was computed for every fixture value using @stdlib/number/float64/base/ulp-difference, taking the per-fixture maximum.
  • The bounds were measured independently for the JavaScript implementation (lib/main.js) and the native implementation (lib/native.js, built via make install-node-addons). Both implementations yield identical maxima, so test.js and test.native.js use the same values.
  • Tightness was confirmed by re-checking each fixture set with the bound decremented by one, which leaves exactly one failing case for medium_positive, close_to_unity, and large_negative, and three failing cases for medium_negative.
  • The suite was run twice at the final bounds to confirm determinism; test.js and test.native.js each report 16007/16007 passing on both runs, and the native add-on was built locally so that test.native.js was exercised rather than skipped.
  • The large bound for large_negative reflects the pre-existing 1e9 * EPS relative tolerance for that fixture; the measured maximum is roughly a factor of five tighter.

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.

Only the two test files are changed; no package.json or source changes were required.

One environment note: the lint-editorconfig-files step could not run locally, as downloading the editorconfig-checker binary is blocked in this environment. The relevant EditorConfig rules (LF line endings, UTF-8, tab indentation, no trailing whitespace, final newline) were instead verified manually, and make lint-javascript-tests TESTS_FILTER=".*/math/base/special/ellipk/.*" passes cleanly.

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 the migration idiom from previously merged conversions, applied the migration, measured the minimum ULP bounds for both the JavaScript and native implementations, and verified tightness and determinism locally.


@stdlib-js/reviewers

Migrate the fixture-based tests from relative tolerance testing to ULP
difference testing using `@stdlib/assert/is-almost-same-value`. The ULP
bounds are the measured minimum over each full fixture set and are
identical for the JavaScript and native implementations.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014DdacVDaTqzaNwnp2NRFn7
@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 5, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/ellipk $\\color{green}869/869$
$\\color{green}+100.00\\%$
$\\color{green}83/83$
$\\color{green}+100.00\\%$
$\\color{green}14/14$
$\\color{green}+100.00\\%$
$\\color{green}869/869$
$\\color{green}+100.00\\%$

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

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants