Skip to content

test: migrate stats/base/dists/geometric/kurtosis to ULP-based assertions - #15915

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-m9bd8n
Oct 12, 2026
Merged

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

Conversation

@kgryte

@kgryte kgryte commented Oct 5, 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:

  • adds the @stdlib/assert/is-almost-same-value import.
  • removes the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps imports, along with the delta and tol locals.
  • replaces the y === expected[i] / t.ok( delta <= tol, ... ) branch with t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );.

ULP bound: 0 (both test/test.js and test/test.native.js).

This is the measured minimum. Over the full 1000-element test/fixtures/julia/data.json set, the maximum ULP difference between the returned value and the expected value is 0 for both the JavaScript and the C implementation — i.e. both implementations reproduce the fixtures bit-for-bit, so no ULP slack is required. Starting from a loose bound and tightening, 0 is the smallest integer that passes, and 0 is also the floor, so no further tightening is possible.

Verification performed:

  • make test TESTS_FILTER=".*/stats/base/dists/geometric/kurtosis/.*" — 1007 passing, 0 failing, for test.js and for test.native.js. The native add-on was compiled locally so that test.native.js actually executed rather than being skipped.
  • The suite was run twice at the final bound; results were identical, so the bound is not sensitive to FMA contraction or other arch-dependent rounding.
  • Independently cross-checked the C routine (src/main.c) against the fixtures outside of the test harness, compiled both at -O2 and at -O3 -march=native -ffp-contract=fast; output was bit-identical in both cases and 0 ULP from the fixtures.
  • make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/geometric/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.

Because the JavaScript and C implementations agree exactly here (identical expression, 6.0 + ( ( p*p ) / ( 1.0-p ) ), with no fusable multiply-add), both test files use the same bound of 0; the JS-vs-C divergence handling described in the FAQ was not needed.

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. It mirrored the idiom from previously merged conversions in this family (e.g. #15801, #15799) and determined the ULP bound empirically as described above.


@stdlib-js/reviewers


🤖 Generated with Claude Code

https://claude.ai/code/session_01UKXg9xt5vVqACoGUcUUVdh


Generated by Claude Code

…rtions

Replace relative tolerance comparisons with `isAlmostSameValue` ULP
difference assertions in both the JavaScript and native test suites. The
measured minimum ULP bound over the full 1000-element Julia fixture set is
`0` for both the JavaScript and C implementations.

Ref: #11352

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/geometric/kurtosis $\\color{green}165/165$
$\\color{green}+100.00\\%$
$\\color{green}9/9$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}165/165$
$\\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 Oct 12, 2026
@kgryte
kgryte marked this pull request as ready for review October 12, 2026 12:56
@kgryte
kgryte requested a review from a team October 12, 2026 12:56
@kgryte
kgryte merged commit 7200560 into develop Oct 12, 2026
66 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-m9bd8n branch October 12, 2026 12:57
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Oct 12, 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