Skip to content

test: migrate math/base/special/truncb to ULP-based assertions - #14170

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-truncb
Aug 11, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-truncb

Conversation

@kgryte

@kgryte kgryte commented Aug 11, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

The ULP bound was tightened to the measured minimum of 1 ULP for both the JavaScript and native test files. Over the 17 subnormal fixtures, 11 cases match exactly (0 ULP) and 6 cases require exactly 1 ULP (e.g. n = -308 returns 2.9999999999999997e-308 versus an expected 3e-308); no case requires more than 1, so 0 would fail and 1 is the tightest passing bound. The full test file was run twice at the final bound with identical results (766 passing assertions, no failures).

This matches the bound and idiom already used by the sibling packages math/base/special/floorb, math/base/special/ceilb, and math/base/special/truncn, which share the identical fixture set. Note that for b = 10 — the case exercised by this test — truncb delegates to truncn in both the JavaScript and C implementations, so the native path is expected to agree with the already-merged truncn native test at 1 ULP.

No implementation files were modified; the only changes are to the two test files.

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 native tests (test/test.native.js) were skipped locally, as the native add-on was not built in the environment used to author this change; npm install could not complete because the available registry mirror had no es-object-atoms@^1.1.2. The JavaScript tests were run directly and pass. Please confirm the native tests in CI.

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

This PR was authored by Claude Code running as an unattended scheduled task. The conversion mirrors the already-merged floorb/ceilb/truncn migrations, and the 1 ULP bound was determined empirically by measuring the minimum passing ULP difference for every fixture rather than assumed.


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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/truncb $\\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 added the Tests Pull requests specifically adding tests. label Aug 11, 2026
@kgryte
kgryte marked this pull request as ready for review August 11, 2026 23:45
@kgryte
kgryte requested a review from a team August 11, 2026 23:45
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 11, 2026
@kgryte
kgryte merged commit e9ab683 into develop Aug 11, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-truncb branch August 11, 2026 23:46
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 11, 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