Skip to content

test: migrate stats/base/dists/geometric/skewness to ULP-based assertions - #15362

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

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

Conversation

@kgryte

@kgryte kgryte commented Sep 20, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Final ULP constant: 0 (used in both test/test.js and test/test.native.js).

This is the measured minimum. The bound was found by measuring the per-fixture ULP difference with @stdlib/number/float64/base/ulp-difference across the full 1000-element Julia fixture set: the largest observed difference is 0, i.e., every returned value is bit-identical to its expected value, so no smaller bound exists. Starting from a high bound and lowering it therefore terminates at 0. The suite was run twice at the final value with identical results (1007/1007 passing), so there is no FMA/arch variation here.

A bound of 0 is consistent with already-migrated sibling packages whose fixtures also match exactly — e.g. stats/base/dists/binomial/kurtosis (a464e88), which likewise migrated to isAlmostSameValue( y, expected[ i ], 0 ) in both its JS and native test files. The implementation is a single expression, ( 2.0-p ) / sqrt( 1.0-p ), and src/main.c evaluates the identical expression with the same operation order, so the native add-on is expected to return the same values; the same bound is therefore used in the native test file.

Only the two test files are changed.

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.

  • make test TESTS_FILTER=".*/stats/base/dists/geometric/skewness/.*" → 1007 passing, 0 failing for test/test.js; test/test.native.js skips, as the native add-on is not built in this environment. Run twice at the final ULP value to confirm determinism.
  • Linting was run with the repository's own ESLint configuration over both changed files and is clean.
  • Note on environment: make install-node-modules fails here because es-object-atoms@^1.1.2 is not published (the reachable registry has at most 1.1.1). This is a pre-existing dependency-resolution failure unrelated to this change; the dependency tree was installed with that transitive version pinned to 1.1.1 so that the project's own make test and ESLint configuration could be used.
  • The editorconfig-checker step could not execute (its binary is downloaded from GitHub releases, which is unavailable here); both files were verified manually against .editorconfig (LF line endings, UTF-8, tab indentation, no trailing whitespace, final newline).

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. Claude studied #11352 and the already-migrated sibling packages to mirror the established idiom, applied the migration, and determined the ULP bound empirically by measuring the per-fixture ULP difference rather than guessing it.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01QG7gEdBDDNd41avDBtd3ge


Generated by Claude Code

…rtions

Replace relative tolerance comparisons with `isAlmostSameValue` ULP
difference assertions, using the minimum required ULP value.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QG7gEdBDDNd41avDBtd3ge
@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. and removed Good First PR A pull request resolving a Good First Issue. labels Sep 20, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/geometric/skewness $\\color{green}166/166$
$\\color{green}+100.00\\%$
$\\color{green}9/9$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}166/166$
$\\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 Issue #11352 is an RFC explicitly scoped to migrating math/base/special packages from relative-tolerance to ULP-based testing (its own instructions say to search for a package "in math/base/special"). This PR migrates tests for stats/base/dists/geometric/skewness, which is outside the 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

Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants