Skip to content

test: migrate math/base/special/fast/pow-int to ULP-based assertions - #14009

Merged
kgryte merged 1 commit into
stdlib-js:developfrom
ujjwalv01:feat-math-base-special-fast-pow-int-ulp
Aug 7, 2026
Merged

kgryte merged 1 commit into
stdlib-js:developfrom
ujjwalv01:feat-math-base-special-fast-pow-int-ulp

Conversation

@ujjwalv01

@ujjwalv01 ujjwalv01 commented Aug 7, 2026 •

Copy link
Copy Markdown
Member

Resolves part of #11352

Description

What is the purpose of this pull request?

This pull request:

  • Migrates tests in @stdlib/math/base/special/fast/pow-int to use ULP-based testing assertions. Specifically, both test.js and test.native.js were updated to replace absolute tolerance checks with exact ULP assertions using @stdlib/assert/is-almost-same-value.

ULP Tolerance Explanation

The ULP tolerance values used (126, 113, and 6) represent the exact, tightest minimums required to pass the test fixtures:

  • decimalInteger: 126 ULP
  • integerInteger: 113 ULP
  • multiplesOfTen: 6 ULP

Previously, the tests used relative absolute tolerances of 70.0 * EPS * abs(expected), 61.0 * EPS * abs(expected), and 3.75 * EPS * abs(expected). Because the absolute value can scale up to almost 2 within a floating-point exponent bin, those older tolerances effectively allowed for up to ~140 ULP, ~122 ULP, and ~7.5 ULP differences in the worst-case scenarios.

By programmatically computing the exact maximum ULP differences against the expected Julia outputs, we were able to successfully tighten these thresholds to the absolute minimum bounds required to pass all edge cases.

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.

No.

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.".


@stdlib-js/reviewers

@ujjwalv01
ujjwalv01 requested a review from a team August 7, 2026 09:33
@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. Needs Review A pull request which needs code review. labels Aug 7, 2026
@kgryte kgryte added difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. Tests Pull requests specifically adding tests. review: 5 and removed Needs Review A pull request which needs code review. labels Aug 7, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/fast/pow-int $\\color{green}323/323$
$\\color{green}+100.00\\%$
$\\color{green}18/18$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}323/323$
$\\color{green}+100.00\\%$

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

@kgryte
kgryte merged commit 6b698ba into stdlib-js:develop Aug 7, 2026
117 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. Good First PR A pull request resolving a Good First Issue. Math Issue or pull request specific to math functionality. review: 5 Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants