FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test: migrate `math/base/special/bessely0` to ULP-based assertions by Planeshifter · Pull Request #14350 · stdlib-js/stdlib · GitHub

test: migrate math/base/special/bessely0 to ULP-based assertions - #14350

Merged
kgryte merged 1 commit into
developfrom
philipp/ulp-bessely0
Aug 17, 2026
Merged

test: migrate math/base/special/bessely0 to ULP-based assertions#14350
kgryte merged 1 commit into
developfrom
philipp/ulp-bessely0

Conversation

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/bessely0 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 and test/test.native.js with a single t.strictEqual( isAlmostSameValue( y, expected[ i ], N ), true, 'returns expected value' ); assertion.
  • removes the now-unused @stdlib/math/base/special/abs require and adds @stdlib/assert/is-almost-same-value. The @stdlib/constants/float64/eps require is retained, as EPS is still used when generating negative inputs.

ULP bounds (per fixture set, identical for test/test.js and test/test.native.js):

Fixture set Previous tolerance ULP bound Next largest ULP difference in set
very_large_positive 680.0 * EPS * abs( expected ) 1127 445
large_positive 2400.0 * EPS * abs( expected ) 3716 232
medium_positive 850.0 * EPS * abs( expected ) 1626 217
small_positive 1000.0 * EPS * abs( expected ) 1510 532
smaller 4.5 * EPS * abs( expected ) 7 6
tiny_positive 10.0 * EPS * abs( expected ) 2 2
subnormal 5000.0 * EPS * abs( expected ) 8678 73
huge_positive 4500.0 * EPS * abs( expected ) 4053 945
positive_gamut 16.0 * EPS * abs( expected ) 25 18

These are the measured minima: each value above is the smallest integer for which the corresponding fixture set passes in full. I computed the exact ULP difference for every fixture point directly (via @stdlib/number/float64/base/ulp-difference) rather than searching by trial and error, so the "next largest" column shows how much headroom each bound has over the runner-up point in its set. The JavaScript and native (C) implementations agree exactly on every fixture point (I built the native add-on locally with make install-node-addons NODE_ADDONS_PATTERN="math/base/special/bessely0" and confirmed identical per-point ULP differences), so the same bounds apply to both test files.

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

The large_positive (3716), subnormal (8678), and huge_positive (4053) bounds are large in absolute terms, but they are strictly tighter than the relative tolerances they replace and reflect the accuracy of the current rational-approximation implementation for Y_0 in these regimes. Happy to instead round these to a nearby convenient value if reviewers prefer some headroom over the measured minimum.

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/bessely0/.*" — 41653 passing, 0 failing.
  • node test/test.js and node test/test.native.js run twice each at the final bounds with identical results (41653 passing both times), so the bounds are not sensitive to FMA/arch variation on this machine.
  • test/test.native.js was exercised against a locally built addon (make install-node-addons NODE_ADDONS_PATTERN="math/base/special/bessely0"), so the native assertions ran rather than being skipped.
  • make lint-javascript-tests TESTS_FILTER=".*/math/base/special/bessely0/.*" — 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 — most directly math/base/special/bessely1 (#14344), converted just prior to this PR in the same Bessel-function family.


@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: passed
  - 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 added Math Issue or pull request specific to math functionality. Good First PR A pull request resolving a Good First Issue. labels Aug 17, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/bessely0 $\\color{red}596/609$
$\\color{green}+97.87\\%$
$\\color{red}45/54$
$\\color{green}+83.33\\%$
$\\color{green}7/7$
$\\color{green}+100.00\\%$
$\\color{red}596/609$
$\\color{green}+97.87\\%$

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

kgryte added the Tests Pull requests specifically adding tests. label Aug 17, 2026
kgryte marked this pull request as ready for review August 17, 2026 22:06
kgryte requested a review from a team August 17, 2026 22:06
stdlib-bot added the Needs Review A pull request which needs code review. label Aug 17, 2026
kgryte merged commit 0acfa70 into develop Aug 17, 2026
82 checks passed
kgryte deleted the philipp/ulp-bessely0 branch August 17, 2026 22:10
stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL