Skip to content

test: migrate math/base/special/betaincinv to ULP-based assertions - #14423

Merged
kgryte merged 2 commits into
developfrom
philipp/ulp-betaincinv
Aug 20, 2026
Merged

kgryte merged 2 commits into
developfrom
philipp/ulp-betaincinv

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 tests for math/base/special/betaincinv from relative tolerance testing to ULP difference testing, per [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • replaces the delta/tol computation and the y === expected special case in test/test.js with a single t.strictEqual( isAlmostSameValue( y, expected[ i ], N ), true, 'returns expected value' ); assertion, using a named ULP constant declared at the top of each test body.
  • removes the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires and adds @stdlib/assert/is-almost-same-value.

ULP bounds (measured minima):

Test Previous tolerance ULP bound Next largest ULP difference in set
lower regularized incomplete beta function 15.0 * EPS * abs( expected ) 20 10
upper regularized incomplete beta function 15.0 * EPS * abs( expected ) 14 13

Each bound is the smallest integer for which the corresponding fixture set (2000 points) passes in full, computed via @stdlib/number/float64/base/ulp-difference over every fixture point directly rather than by trial and error.

There is no test/test.native.js for this package, so only test/test.js is changed. No source, documentation, or package.json changes are included.

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.

Verification performed locally:

  • make test TESTS_FILTER=".*/math/base/special/betaincinv/.*" — 4020 passing, 0 failing (run twice at the final bounds with identical results, so the bounds are not sensitive to FMA/arch variation on this machine).
  • Confirmed tightness: lowering either bound by 1 ULP (19 and 13) produces 2 failures.
  • npx eslint on the changed file — clean.
  • make lint-javascript-tests TESTS_FILTER=".*/math/base/special/betaincinv/.*" — clean.

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. The candidate discovery (scanning the whole repo for the old tolerance idiom, then checking existing ULP-migration PRs to avoid collisions), the test migration, and the ULP bound search (computing the exact per-point ULP difference directly, then confirming determinism via repeated runs) were performed by the agent, following the idiom established in already-migrated packages in math/base/special (e.g. erfcinv, #13761, and bessely0, #14350).


@stdlib-js/reviewers


Generated by Claude Code

Ref: #11352

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: skipped
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@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 19, 2026
@stdlib-bot

stdlib-bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/betaincinv $\\color{green}133/133$
$\\color{green}+0.00\\%$
$\\color{green}14/14$
$\\color{green}+0.00\\%$
$\\color{green}1/1$
$\\color{green}+0.00\\%$
$\\color{green}133/133$
$\\color{green}+0.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 20, 2026
Comment thread lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js Outdated
Comment thread lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js Outdated
Comment thread lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js Outdated
Comment thread lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js Outdated
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
@kgryte
kgryte marked this pull request as ready for review August 20, 2026 01:54
@kgryte
kgryte requested a review from a team August 20, 2026 01:54
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 20, 2026
@kgryte
kgryte merged commit 3d3d4bf into develop Aug 20, 2026
30 checks passed
@kgryte
kgryte deleted the philipp/ulp-betaincinv branch August 20, 2026 01:57
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 20, 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