Skip to content

test: migrate stats/base/dists/weibull/kurtosis to ULP-based assertions - #15516

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-lboj1w
Sep 24, 2026
Merged

kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-lboj1w

Conversation

@kgryte

@kgryte kgryte commented Sep 24, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Specifically, in both test/test.js and test/test.native.js:

  • adds the @stdlib/assert/is-almost-same-value require and removes the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.
  • removes the delta and tol declarations and the computed tolerance logic (tol = 1.5e6 * EPS * abs( expected[ i ] )).
  • replaces the y === expected[i] / t.ok( delta <= tol, ... ) branch with a single t.strictEqual( isAlmostSameValue( y, expected[ i ], 1292760 ), true, 'returns expected value' );.

ULP constant: 1292760 (same value in test/test.js and test/test.native.js).

This is the measured minimum. Starting from a high bound and tightening over the full 500-case Julia fixture set, 1292760 is the smallest integer for which every case passes:

ULP bound failing fixtures
1292758 1
1292759 1
1292760 0

The worst case is k = 19.094404848351264, lambda = 17.223983273178845, where the implementation returns 1.2261287913603294 against an expected 1.226128791073279 (a relative difference of ~2.3e-10, consistent with the previous 1.5e6 * EPS relative tolerance).

The JavaScript and C implementations require the identical bound (both measured at 1292760), so a single constant is used in both 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?

The required bound here is large (1292760), inherited from the package's pre-existing 1.5e6 * EPS relative tolerance rather than introduced by this change. It is within the range of bounds already used elsewhere in the codebase after migration. Happy to revisit if maintainers would prefer the underlying accuracy of the implementation be addressed first, in which case this migration could wait.

Other

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

Verification performed:

  • make test TESTS_FILTER=".*/stats/base/dists/weibull/kurtosis/.*" — 514/514 passing in test/test.js.
  • The native addon was built locally (node-gyp rebuild) so that test/test.native.js was actually exercised rather than skipped — also 514/514 passing.
  • The suite was run twice at the final bound; results were identical across runs (no FMA/arch-dependent variation observed).
  • make eslint-tests TESTS_FILTER=".*/stats/base/dists/weibull/kurtosis/.*" — clean.
  • Only the two test files are modified; no changes to the implementation, fixtures, or docs.

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. It studied the idiom established in previously merged migrations (notably the sibling stats/base/dists/weibull/skewness, #15484, and stats/base/dists/geometric/mean, #15491, for the EPS-require removal), applied the same mechanical transformation here, and determined the ULP bound empirically by measuring the required ULP distance across the full fixture set rather than by guessing and re-running.


@stdlib-js/reviewers


Generated by Claude Code

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/weibull/kurtosis $\\color{green}208/208$
$\\color{green}+100.00\\%$
$\\color{green}10/10$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}208/208$
$\\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 Sep 24, 2026
@kgryte
kgryte marked this pull request as ready for review September 24, 2026 23:50
@kgryte
kgryte requested a review from a team September 24, 2026 23:50
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 24, 2026
@kgryte
kgryte merged commit 57344d1 into develop Sep 24, 2026
82 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-lboj1w branch September 24, 2026 23:51
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 24, 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