Skip to content

test: migrate complex/float64/base/div to ULP-based assertions - #16221

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-complex-float64-base-div
Oct 24, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-complex-float64-base-div

Conversation

@kgryte

@kgryte kgryte commented Oct 18, 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 complex/float64/base/div from relative tolerance testing to ULP difference testing, per [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • replaces the if ( actual === expected ) { ... } else { delta/tol ... } fixture-loop blocks in test/test.main.js, test/test.assign.js, test/test.strided.js, and test/test.native.js with t.strictEqual( isAlmostSameValue( actual, expected, <ulp> ), true, 'returns expected value' );.
  • adds the @stdlib/assert/is-almost-same-value require and removes the now unused @stdlib/constants/float64/eps and @stdlib/math/base/special/abs requires, along with the local delta and tol declarations.

ULP bounds (104 converted assertion sites in total):

  • 0 ULP at 100 sites (all of test.main.js, test.assign.js, test.strided.js, and 22 of the 26 sites in test.native.js). Each site was measured by computing, per fixture element, the smallest maxULP for which isAlmostSameValue returns true and taking the maximum over the full fixture set; every real and imaginary component matches the Julia fixtures exactly, so the measured minimum is 0. The previous relative tolerance branches were in fact never exercised, as the exact-equality branch was always taken.
  • 2 ULP at the 4 sites in test.native.js which carry the pre-existing note regarding JavaScript vs. C result divergence (previously tol = 2.0 * EPS * abs( expected )). The measured minimum for these sites is also 0 on this toolchain (gcc, x86_64), but the bound mirrors the previous relative tolerance budget so as to preserve the documented allowance for compiler optimizations on other platforms. Happy to tighten these to 0 if preferred.

Verification:

  • make test TESTS_FILTER=".*/complex/float64/base/div/.*" is green (52,264 assertions). The native add-on was built locally via make install-node-addons NODE_ADDONS_PATTERN='complex/float64/base/div' so that test/test.native.js actually runs rather than being skipped.
  • The suite was run twice at the final ULP values with identical results.
  • make lint-javascript-tests TESTS_FILTER=".*/complex/float64/base/div/.*" is clean.
  • Only test files are modified.

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?

  • Should the four test.native.js sites carrying the JavaScript vs. C divergence note be tightened to the measured minimum of 0, or retained at 2 ULP as proposed above?

Other

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

No.

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, which performed the test migration and measured the minimum ULP bounds empirically against the existing fixtures.


@stdlib-js/reviewers


Generated by Claude Code

Resolves a part of #11352.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0153Sspr4MbYTXYTXwtwifQ5
@stdlib-bot stdlib-bot added the Good First PR A pull request resolving a Good First Issue. label Oct 18, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
complex/float64/base/div $\\color{green}466/466$
$\\color{green}+100.00\\%$
$\\color{green}25/25$
$\\color{green}+100.00\\%$
$\\color{green}6/6$
$\\color{green}+100.00\\%$
$\\color{green}466/466$
$\\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 Oct 24, 2026
@kgryte
kgryte marked this pull request as ready for review October 24, 2026 02:33
@kgryte
kgryte requested a review from a team October 24, 2026 02:33
@kgryte
kgryte merged commit 9a077a2 into develop Oct 24, 2026
50 checks passed
@kgryte
kgryte deleted the kgryte/ulp-complex-float64-base-div branch October 24, 2026 02:35
@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 Oct 24, 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. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants