Skip to content

test: migrate math/base/special/rad2degf to ULP-based assertions - #13970

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-rad2degf
Aug 6, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-rad2degf

Conversation

@kgryte

@kgryte kgryte commented Aug 6, 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/rad2degf from relative tolerance (EPS-scaled) assertions to ULP-based assertions using @stdlib/number/float32/base/assert/is-almost-same-value, matching the idiom already used by other single-precision packages (e.g., acotdf, asecdf, atanf, hypotf).
  • updates both test/test.js and test/test.native.js, removing the EPS/abs imports and the delta/tol computations in favor of t.strictEqual( isAlmostSameValuef( r, e, 1 ), true, 'returns expected value' );.

Final ULP constant: 1 for every converted assertion, in both the JavaScript and native test files.

The bound was tightened empirically rather than guessed. Starting from a high bound and lowering it, the measured maximum ULP distance over the full fixture set (2003 points in test/fixtures/julia/data.json) plus the 32 canonical angle cases (16 positive and 16 negative) is 1 ULP for both the JavaScript and the C implementation. 1 is therefore the minimum: at N = 0 the suite fails with 620 failing assertions (both files), and at N = 1 all 2041 assertions pass.

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 modified; no implementation, fixture, or documentation changes.
  • The native add-on was built locally (make install-node-addons NODE_ADDONS_PATTERN=rad2degf) so that test/test.native.js genuinely executed rather than being skipped. Both files report 2041/2041 passing, and the suite was run twice at the final bound to confirm the result is deterministic (no FMA/architecture-dependent flakiness).
  • The JavaScript and C implementations agree exactly on the worst case, so a single ULP constant is used for both test files.

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 as part of an automated, unattended run: it selected the package, studied the idiom used in previously merged conversions, applied the test edits, and measured the minimum passing ULP bound by running the suite.


@stdlib-js/reviewers


Generated by Claude Code

@stdlib-bot stdlib-bot added Good First PR A pull request resolving a Good First Issue. Math Issue or pull request specific to math functionality. labels Aug 6, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/rad2degf $\\color{green}159/159$
$\\color{green}+100.00\\%$
$\\color{green}5/5$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}159/159$
$\\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 6, 2026
@kgryte
kgryte marked this pull request as ready for review August 6, 2026 11:04
@kgryte
kgryte requested a review from a team August 6, 2026 11:04
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 6, 2026
@kgryte
kgryte merged commit e1cc737 into develop Aug 6, 2026
84 checks passed
@kgryte
kgryte deleted the kgryte/ulp-rad2degf branch August 6, 2026 11:04
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 6, 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