Skip to content

test: migrate stats/base/dists/invgamma/skewness to ULP-based assertions - #14573

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-stats-base-dists-invgamma-skewness
Draft

test: migrate stats/base/dists/invgamma/skewness to ULP-based assertions#14573
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-stats-base-dists-invgamma-skewness

Conversation

@kgryte

@kgryte kgryte commented Aug 23, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

ULP bound: 0 (both test/test.js and test/test.native.js), the measured minimum over the fixture set.

The bound was determined empirically rather than assumed: for every fixture, the minimum admissible bound was found by scanning isAlmostSameValue upward from 0, and the maximum over the full Julia fixture set (all 200 values) is exactly 0. That is, the implementation reproduces every fixture value bit-for-bit, so the bound is already at its floor and cannot be tightened further. The previous relative tolerance was 2.0 * EPS, so this is a tightening, not a loosening, of the prior accuracy budget. Note that the removed if ( y === expected[ i ] ) { ... } else { ... } branch was therefore always taking the exact-equality path.

The suite was run twice at the final bound with identical results (214/214 passing each time), so the bound is not sensitive to run-to-run variation.

The native addon was built locally for this package, so test/test.native.js was actually exercised rather than skipped (214/214 passing, twice, with no skipped assertions). Evaluating the C implementation over the same fixtures gives a maximum ULP difference of 0 as well, attained with all 200 values matching exactly, so a single bound is correct across both suites. This matches the sibling conversions in this family (erlang/skewness, gamma/kurtosis, weibull/entropy), which likewise use a single bound across both suites.

Only the two test files are modified; no implementation, fixture, or documentation changes are included.

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.

Two environment notes, neither of which affects the diff:

  • make install-node-modules initially failed in this sandbox because the npm registry mirror serves string.prototype.trim@1.2.11 but not its es-object-atoms@^1.1.2 dependency. Installation succeeded with a temporary, local-only overrides entry pinning string.prototype.trim to 1.2.10; package.json was restored immediately afterwards and is unchanged in this PR.
  • The lint-editorconfig pre-commit hook could not run because the editorconfig-checker wrapper downloads its binary from GitHub releases, which is not reachable from this sandbox. The two changed files were instead verified manually against .editorconfig (LF endings, UTF-8, tab indentation, no trailing whitespace, final newline). make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/invgamma/skewness/.*" passes cleanly.

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 previously merged conversions under #11352 (including the erlang/skewness sibling) to match the established idiom, applied the migration, measured the minimum ULP bound empirically against the fixtures for both the JS and the native implementations, and verified that the tests pass deterministically and that the files lint cleanly.


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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/invgamma/skewness $\\color{green}193/193$
$\\color{green}+100.00\\%$
$\\color{green}10/10$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}193/193$
$\\color{green}+100.00\\%$

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

Copy link
Copy Markdown
Member

⚠️ Issue Reference Review

An automated check found potentially unrelated issue/PR references in this PR:

Reference Assessment Reasoning
#11352 suspicious #11352 is an RFC/tracking issue explicitly scoped to migrating math/base/special packages to ULP-based testing, but this PR migrates tests for stats/base/dists/invgamma/skewness, which is outside that issue's stated scope.

Why this matters: GitHub automatically closes issues referenced with
closing keywords (Resolves, Closes, Fixes) when the PR is merged. Incorrect
references can accidentally close unrelated issues.

What to do:

  • If the reference is correct, no action needed. This check may produce
    false positives.
  • If the reference is incorrect, please update your PR description.

This assessment was generated by an AI model and is informational only.


Generated by Claude Code

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants