Skip to content

test: migrate stats/base/dists/pareto-type1/kurtosis to ULP-based assertions - #14119

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-gxsm8v
Aug 10, 2026
Merged

test: migrate stats/base/dists/pareto-type1/kurtosis to ULP-based assertions#14119
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-gxsm8v

Conversation

@kgryte

@kgryte kgryte commented Aug 10, 2026

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

Changes are confined to test/test.js and test/test.native.js. In both files, the abs/EPS requires are replaced by isAlmostSameValue, the delta/tol locals are dropped, and the exact-vs-tolerance branch in the fixture loop collapses to a single assertion:

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

Final ULP constants and measured minimum

File Previous tolerance ULP bound Measured minimum
test/test.js 1.0 * EPS * abs( expected ) 0 0
test/test.native.js 2.0 * EPS * abs( expected ) 0 0

Both bounds were tightened to the measured minimum of 0 ULP. Starting from a high bound and lowering it, the per-fixture minimum ULP distance was measured across the full fixture set (1000 cases in test/fixtures/julia/data.json): both the JavaScript implementation and the C implementation reproduce the Julia reference values bit-exactly for every case, so no non-zero bound is required. 0 is the tightest representable bound, so no further lowering is possible.

The native addon was compiled locally so that test.native.js was actually exercised rather than skipped (1017 assertions passing, 0 skipped). Both suites were run repeatedly at the final bound and passed identically each time, indicating no FMA/architecture-dependent variation. The excess kurtosis is a closed-form rational expression in alpha, which is consistent with the observed bit-exactness.

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 C implementation measured bit-exact against the fixtures on this machine (Linux x86-64, gcc), so both bounds are set to 0. If the project would rather keep a small non-zero margin in test.native.js to absorb possible FMA contraction on other toolchains/architectures, I'm happy to raise that one bound.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Linting note: make lint could not be run in this environment because make install-node-modules fails during dependency resolution (npm error notarget No matching version found for es-object-atoms@^1.1.2), which is unrelated to this change. The two changed files were instead checked with a standalone ESLint pass for unused variables and related issues, and came back clean; the diff otherwise mirrors the shape of already-merged conversions such as stats/base/dists/halfnormal/stdev and stats/base/dists/weibull/logcdf. CI should be treated as the authoritative lint check here.

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 written by Claude Code running as an unattended scheduled task. It studied previously merged ULP conversions to match the established idiom, applied the test changes, compiled the native addon, and measured the minimum passing ULP bound empirically over the full fixture set.


@stdlib-js/reviewers


Generated by Claude Code

…ssertions

Replaces the relative-tolerance comparisons in `test.js` and
`test.native.js` with `isAlmostSameValue` ULP-difference assertions.

Both the JavaScript and C implementations are bit-exact against the
Julia fixtures over all 1000 cases, so the ULP bound is tightened to 0
(previously 1.0*EPS and 2.0*EPS relative tolerances, respectively).

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VRnhaYbnH5rDnzzpfGqT3o
@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 10, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/pareto-type1/kurtosis $\\color{green}199/199$
$\\color{green}+100.00\\%$
$\\color{green}10/10$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}199/199$
$\\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 10, 2026
@kgryte
kgryte marked this pull request as ready for review August 10, 2026 06:46
@kgryte
kgryte requested a review from a team August 10, 2026 06:46
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 10, 2026
@kgryte
kgryte merged commit d844b50 into develop Aug 10, 2026
82 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-gxsm8v branch August 10, 2026 06:47
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 10, 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