Skip to content

test: migrate math/base/special/roundb to ULP-based assertions - #14538

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-roundb
Aug 22, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-roundb

Conversation

@kgryte

@kgryte kgryte commented Aug 22, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Specifically, in both test/test.js and test/test.native.js, the delta/tol computation in the "the function supports rounding very small numbers (including subnormals)" test is replaced with a single isAlmostSameValue assertion, the now-unused @stdlib/constants/float64/eps and @stdlib/math/base/special/abs requires are removed, and @stdlib/assert/is-almost-same-value is added.

Final ULP constants:

File ULP
test/test.js 1
test/test.native.js 1

Both values are the measured minimum. Over the full set of 17 fixture cases, the maximum observed ULP difference is 1 for both the JavaScript and C implementations (5 of the 17 cases differ by exactly 1 ULP; the remaining 12 are bit-for-bit exact). Lowering the bound to 0 fails, so 1 is the tightest bound which passes.

The suite was run twice at the final ULP value, with the native add-on built locally so that test/test.native.js actually executes rather than being skipped. Both runs were green and identical (test.js: 668/668; test.native.js: 658/658), confirming no FMA/architecture-related non-determinism.

Only the two 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?

No.

Other

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

The conversion mirrors the idiom established in math/base/special/croundn (#14327), which has a structurally identical subnormal rounding test.

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 selected the package, studied prior conversions in the repository to match the established idiom, applied the edits, and measured the minimum ULP bound by running the test suite.


@stdlib-js/reviewers


Generated by Claude Code

@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 22, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/roundb $\\color{green}203/203$
$\\color{green}+100.00\\%$
$\\color{green}24/24$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}203/203$
$\\color{green}+100.00\\%$

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

@kgryte
kgryte marked this pull request as ready for review August 22, 2026 21:27
@kgryte
kgryte requested a review from a team August 22, 2026 21:27
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 22, 2026
@kgryte kgryte added the Tests Pull requests specifically adding tests. label Aug 22, 2026
@kgryte
kgryte merged commit 354db88 into develop Aug 22, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-roundb branch August 22, 2026 21:28
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 22, 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