Skip to content

test: migrate stats/base/dists/hypergeometric/kurtosis to ULP-based assertions - #15679

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-vxaa5w
Sep 30, 2026
Merged

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

Conversation

@kgryte

@kgryte kgryte commented Sep 30, 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 in both test/test.js and test/test.native.js.

The bound was tightened empirically rather than assumed. Starting from a high bound and bisecting per fixture, the maximum ULP difference across all 100 Julia fixture values was measured as 0 for both the JavaScript and the C implementation — that is, both reproduce every fixture value bit-for-bit, so 0 is the measured minimum (and the smallest admissible value, since maxULP is a nonnegative integer).

This is consistent with the implementations: both lib/main.js and src/main.c evaluate the excess kurtosis using only IEEE 754 basic arithmetic (+, -, *, /), with no transcendental calls, so exactly-rounded results are expected.

Only the two test files are changed; the implementation, fixtures, and docs are untouched. The previous assertions already took the exact-equality branch for every fixture (tol was 1.0 * EPS * abs( expected[ i ] )), so this migration preserves the existing strictness.

Verification performed:

  • make test TESTS_FILTER=".*/stats/base/dists/hypergeometric/kurtosis/.*" — 120/120 passing in test/test.js and 120/120 passing in test/test.native.js. The C addon was built locally, so the native tests genuinely ran rather than being skipped. The suite was run twice at the final ULP value with identical results.
  • make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/hypergeometric/kurtosis/.*" — clean.

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.

The idiom follows the already-converted sibling package stats/base/dists/hypergeometric/skewness, which has the same signature and fixture layout.

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 unattended as a scheduled task. The ULP bound was measured empirically by bisecting the per-fixture ULP difference against the package's own fixtures, not guessed; the resulting test suites were then executed twice at the final bound to confirm determinism.


@stdlib-js/reviewers


Generated by Claude Code

… assertions

Replace relative tolerance assertions with ULP difference assertions using
`@stdlib/assert/is-almost-same-value`. Both the JavaScript and C
implementations reproduce all 100 Julia fixture values exactly, so the
minimum required ULP bound is 0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rm5v6R5JFbwVZMqaYZWitD
@stdlib-bot stdlib-bot added the Good First PR A pull request resolving a Good First Issue. label Sep 30, 2026
@kgryte kgryte added the Tests Pull requests specifically adding tests. label Sep 30, 2026
@kgryte
kgryte marked this pull request as ready for review September 30, 2026 06:49
@kgryte
kgryte requested a review from a team September 30, 2026 06:49
@kgryte
kgryte merged commit a8b5b2e into develop Sep 30, 2026
50 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-vxaa5w branch September 30, 2026 06:50
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

No coverage information available.

@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Sep 30, 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