Skip to content

test: migrate math/base/special/csignum to ULP-based assertions - #14080

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-csignum
Draft

test: migrate math/base/special/csignum to ULP-based assertions#14080
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-csignum

Conversation

@kgryte

@kgryte kgryte commented Aug 9, 2026

Copy link
Copy Markdown
Member

Progresses #11352.

Description

What is the purpose of this pull request?

This pull request:

ULP constants

The single Julia fixture block (2003 values × 2 components = 4006 comparisons) was measured directly against @stdlib/number/float64/base/ulp-difference:

File Fixture block ULP constant used Measured minimum
test/test.js data 0 0
test/test.native.js data 0 0

Measured minimum was 0 for both the JavaScript and the native implementation — every fixture value matched bit-for-bit on this machine (linux/x86_64, gcc), including the ±0 entries, for which isAlmostSameValue falls back to SameValue semantics at 0 ULP. Both files therefore use the measured minimum of 0.

One note for reviewers: the native path reaches stdlib_base_hypot (via stdlib_base_cabs), which evaluates 1.0 + ( b * b ) — an FMA-contraction candidate. That did not produce any divergence here, so test/test.native.js carries the measured minimum rather than headroom, but I'm happy to raise the native constant to 1 (with an explanatory NOTE, as in math/base/special/cinv) if reviewers would prefer insulation against architectures where the contraction fires.

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?

Yes — see the note above: should test/test.native.js keep the measured minimum of 0, or carry 1 ULP of headroom for potential FMA contraction inside hypot?

Other

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

  • Only test/test.js and test/test.native.js are modified; no fixtures, source, or documentation changed.
  • The native addon was built locally (node-gyp rebuild) so that test/test.native.js actually executed rather than being skipped; the run reports zero SKIP directives. Both suites pass (4018 assertions each), and both were run twice at the final constants with identical results. The locally built build/ and src/addon.node artifacts were removed before committing.
  • eslint --config etc/eslint/.eslintrc.tests.js reports zero problems for both files.
  • make lint-editorconfig-files could not run in this environment (the editorconfig-checker binary download is blocked); formatting was instead verified manually against .editorconfig (LF endings, tab indentation, no trailing whitespace, final newline).

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 on my account. It surveyed already-merged ULP migrations to match the established idiom, applied the mechanical test conversion, measured the ULP distances empirically, and drafted this description. Opened as a draft pending my own review.


@stdlib-js/reviewers


Generated by Claude Code

Migrate the `math/base/special/csignum` test suites from computed
`EPS`-based relative tolerances to ULP-based assertions using
`@stdlib/assert/is-almost-same-value`.

Ref: #11352
@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 9, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/csignum $\\color{green}169/169$
$\\color{green}+100.00\\%$
$\\color{green}7/7$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}169/169$
$\\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.

3 participants