Skip to content

test: migrate stats/base/dists/normal/cdf to ULP-based assertions - #14274

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-normal-cdf
Aug 15, 2026
Merged

test: migrate stats/base/dists/normal/cdf to ULP-based assertions#14274
kgryte merged 1 commit into
developfrom
kgryte/ulp-normal-cdf

Conversation

@kgryte

@kgryte kgryte commented Aug 15, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Changes are confined to test/test.cdf.js, test/test.factory.js, and test/test.native.js. In each fixture loop, var delta/var tol and the abs( y - expected[i] ) <= EPS * abs( expected[i] ) comparison are replaced with t.strictEqual( isAlmostSameValue( y, expected[ i ], N ), true, 'returns expected value' ), and the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires are removed in favor of @stdlib/assert/is-almost-same-value.

The ULP bounds were measured against the full fixture set (1000 cases per fixture) and tightened to the minimum passing integer:

Fixture Previous tolerance ULP bound
positive_mean.json 1600.0 * EPS 2207
negative_mean.json 1600.0 * EPS 2433
large_variance.json 250.0 * EPS 4

Each bound is the measured maximum ULP difference over its fixture, and is minimal: lowering any of them by one causes that fixture to fail. The same bounds apply to all three test files, as the C implementation returns bit-identical values to the JavaScript implementation for all 3000 fixture cases (verified locally with the native add-on built), so no JS vs. C divergence needed to be accounted for.

The full package test suite (make test TESTS_FILTER=".*/stats/base/dists/normal/cdf/.*") passes, including test.native.js against a locally built add-on, and was run twice at the final ULP values to confirm the results are deterministic. make eslint-tests is clean for the package.

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

This PR was authored by Claude Code, following the migration pattern established in previously merged conversions (e.g. #14267, #14258, #14272). The ULP bounds were determined empirically by measuring ULP differences across the full fixture set and verifying minimality, rather than guessed.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added Good First PR A pull request resolving a Good First Issue. Statistics Issue or pull request related to statistical functionality. labels Aug 15, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/normal/cdf $\\color{green}299/299$
$\\color{green}+100.00\\%$
$\\color{green}25/25$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}299/299$
$\\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 15, 2026
@kgryte
kgryte marked this pull request as ready for review August 15, 2026 02:28
@kgryte
kgryte requested a review from a team August 15, 2026 02:28
@kgryte
kgryte merged commit 8ce6411 into develop Aug 15, 2026
70 checks passed
@kgryte
kgryte deleted the kgryte/ulp-normal-cdf branch August 15, 2026 02:29
@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 15, 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. Statistics Issue or pull request related to statistical functionality. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants