Skip to content

test: migrate stats/base/dists/arcsine/logcdf to ULP-based assertions - #14180

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-arcsine-logcdf
Aug 11, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-arcsine-logcdf

Conversation

@kgryte

@kgryte kgryte commented Aug 11, 2026

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

Affected files: test/test.logcdf.js and test/test.factory.js. The package has no test/test.native.js, and test/test.js contains only exact export assertions and is left unchanged.

Each fixture loop of the form

if ( y === expected[i] ) {
    t.strictEqual( y, expected[i], ... );
} else {
    delta = abs( y - expected[ i ] );
    tol = 20.0 * EPS * abs( expected[ i ] );
    t.ok( delta <= tol, ... );
}

is replaced by

t.strictEqual( isAlmostSameValue( y, expected[i], <ulps> ), true, 'returns expected value' );

and the now-unused abs/EPS requires and delta/tol locals are removed.

ULP bounds. Mirroring the surrounding stats/base/dists conversions, each fixture group uses its own bound, tightened to the measured minimum that passes over the full fixture set (1000 values per fixture, identical for the main and factory code paths):

Fixture Previous tolerance ULP bound
small_range.json 20.0 * EPS * abs( expected[i] ) 18
medium_range.json 20.0 * EPS * abs( expected[i] ) 19
large_range.json 30.0 * EPS * abs( expected[i] ) 33

These are minimal: decrementing any of the three bounds to 17 / 18 / 32 fails exactly one assertion in each corresponding group, in both test.logcdf.js and test.factory.js.

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 on linux/x64, Node.js v22:

  • test/test.logcdf.js (3011 assertions), test/test.factory.js (3016 assertions), and test/test.js (3 assertions) all pass. The suite was run twice at the final bounds with identical results, to rule out FMA/arch-dependent flakiness.
  • make eslint-tests TESTS_FILTER=".*/stats/base/dists/arcsine/logcdf/.*" is clean.
  • Only the two test files are modified; no source, fixture, or documentation changes.

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

This PR was written by Claude Code, which performed the test migration, measured the minimum ULP bounds against the fixtures, and ran the test and lint checks.


@stdlib-js/reviewers


Generated by Claude Code

Replaces the relative tolerance (`EPS`-scaled) fixture assertions with
ULP-based assertions using `@stdlib/assert/is-almost-same-value`. The
ULP bounds are the measured minimums which pass over the full fixture
set (1000 values per fixture): 18 (small range), 19 (medium range), and
33 (large range).

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T3AYP1piEzo99Hn2hKhfPa
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Good First PR A pull request resolving a Good First Issue. labels Aug 11, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/arcsine/logcdf $\\color{green}237/237$
$\\color{green}+100.00\\%$
$\\color{green}25/25$
$\\color{green}+100.00\\%$
$\\color{green}3/3$
$\\color{green}+100.00\\%$
$\\color{green}237/237$
$\\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 11, 2026
@kgryte
kgryte marked this pull request as ready for review August 11, 2026 23:38
@kgryte
kgryte requested a review from a team August 11, 2026 23:38
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 11, 2026
@kgryte
kgryte merged commit 99b2dea into develop Aug 11, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-stats-base-dists-arcsine-logcdf branch August 11, 2026 23:39
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 11, 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