Skip to content

test: migrate math/base/tools/normhermitepoly to ULP-based assertions - #14503

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-normhermitepoly
Draft

test: migrate math/base/tools/normhermitepoly to ULP-based assertions#14503
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-normhermitepoly

Conversation

@kgryte

@kgryte kgryte commented Aug 22, 2026

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/tools/normhermitepoly from relative-tolerance assertions (delta <= tol, with delta = abs( v - expected[ i ] ) and tol = EPS * abs( expected[ i ] )) to ULP-difference assertions using @stdlib/assert/is-almost-same-value.
  • applies the same migration to both test/test.js and test/test.factory.js (16 fixture blocks in each).
  • preserves all existing test cases, structure, and non-tolerance assertions (e.g., the special-case values for n = 0, NaN inputs, negative integer n, and non-integer n).

The minimum ULP bound used per fixture block (identical for test.js and test.factory.js) is:

Fixture block ULP
random2 (random n and x) 0
small_positive_{1,2,5} 0
small_negative_{1,2,5} 0
tiny_{1,2,5} 0
medium_positive_{1,2,5} 0
medium_negative_{1,2,5} 0

Each ULP value is the minimum integer N such that isAlmostSameValue( actual, expected, N ) holds for every fixture entry in that block. Starting from N = 64 and tightening, every one of the 16,000 fixture values per file is bit-for-bit identical to the expected value, so 0 is the measured minimum (and the floor). This is expected here: the implementation evaluates the probabilists' Hermite recurrence using only IEEE 754 double-precision addition, subtraction, and multiplication, all of which are exactly specified by the ECMAScript standard, so results are bit-reproducible across engines and architectures. There is no C implementation for this package and therefore no test/test.native.js to migrate.

Tests were run twice at the final N to confirm deterministic passing (32,020 assertions, all passing on both runs). Linting was checked before and after the change and is unchanged (the pre-existing reports are identical in count and rule breakdown), and the only files changed are 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.

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 PR was authored by Claude Code: the assistant mechanically converted the tolerance-based assertions to isAlmostSameValue, agentically searched for the minimum ULP bound per fixture block, verified determinism across two full runs, and ran the local lint and test suites before submitting.


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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/tools/normhermitepoly $\\color{green}226/226$
$\\color{green}+100.00\\%$
$\\color{green}27/27$
$\\color{green}+100.00\\%$
$\\color{green}3/3$
$\\color{green}+100.00\\%$
$\\color{green}226/226$
$\\color{green}+100.00\\%$

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

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants