Skip to content

test: migrate math/base/special/floorn to ULP-based testing - #13883

Merged
kgryte merged 1 commit into
developfrom
philipp/ulp-floorn
Aug 3, 2026
Merged

kgryte merged 1 commit into
developfrom
philipp/ulp-floorn

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates the test suite for math/base/special/floorn from relative tolerance testing (a computed EPS-based delta/tol comparison) to ULP difference testing using @stdlib/assert/is-almost-same-value, per the pattern described in [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • applies the same change to both test/test.js and test/test.native.js, which contained an identical tolerance block in the "supports rounding very small numbers (including subnormals)" test case.
  • determines the minimum required ULP tolerance agentically: starting from a generous bound (64 ULPs) and lowering it until the full fixture set no longer passed, then confirming the tightest passing value is deterministic (no FMA/architecture flakiness) by re-running the suite. The minimum required ULP difference is 1.

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.

Verified locally:

  • node_modules/.bin/tape test/test.js → 450/450 passing, run twice to confirm determinism at ULP=1.
  • node_modules/.bin/eslint test/test.js test/test.native.js → clean.
  • test/test.native.js test cases are skipped locally (no compiled native addon available in this environment), but the tolerance block was identical in source and was updated identically to test.js.
  • Only the two test files changed; no package.json update was needed since @stdlib/assert/is-almost-same-value is an internal stdlib package.

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 written primarily by Claude Code (an AI coding assistant), converting the existing relative-tolerance test case to ULP-based assertions following the established pattern from previously merged conversions in this tracking issue (e.g. math/base/special/roundn, math/base/special/csc). The minimum ULP bound was determined empirically by running the actual test suite.


@stdlib-js/reviewers


Generated by Claude Code

Replace relative tolerance testing (EPS-based delta/tol comparison)
with ULP difference testing via `@stdlib/assert/is-almost-same-value`
for the subnormal rounding test case.

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/floorn $\\color{green}272/272$
$\\color{green}+100.00\\%$
$\\color{green}24/24$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}272/272$
$\\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 3, 2026
@kgryte
kgryte marked this pull request as ready for review August 3, 2026 10:29
@kgryte
kgryte requested a review from a team August 3, 2026 10:29
@kgryte
kgryte merged commit a718677 into develop Aug 3, 2026
69 checks passed
@kgryte
kgryte deleted the philipp/ulp-floorn branch August 3, 2026 10:30
@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 Aug 3, 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.

4 participants