Skip to content

test: migrate stats/base/dists/binomial/kurtosis to ULP-based assertions - #15345

Draft
Planeshifter wants to merge 1 commit into
developfrom
philipp/ulp-binomial-kurtosis
Draft

Planeshifter wants to merge 1 commit into
developfrom
philipp/ulp-binomial-kurtosis

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates the tests for stats/base/dists/binomial/kurtosis from relative tolerance testing to ULP difference testing, replacing the abs( y - expected[i] ) <= tol comparisons with @stdlib/assert/is-almost-same-value. The idiom mirrors the already-migrated sibling package stats/base/dists/binomial/entropy.

Files changed: test/test.js and test/test.native.js. No non-test files are modified, and no test fixtures, expected values, or test cases were added, removed, or altered.

Every fixture-driven comparison in this package resolves exactly (ULP = 0), for both the JavaScript and native implementations, even though the original tolerance code allowed 1.0 * EPS (JS) and 30.0 * EPS (native).

File Fixture assertions ULP Previous tol multiplier
test/test.js 200 0 1.0 * EPS
test/test.native.js 200 0 30.0 * EPS

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 bound was measured directly, not just probed via test runs: for every fixture, the actual output was computed by requiring the package's lib/main.js (JS) and lib/native.js (compiled native add-on, built locally via make install-node-addons NODE_ADDONS_PATTERN="stats/base/dists/binomial/kurtosis") implementations directly and diffing against the expected fixture values with @stdlib/number/float64/base/ulp-difference; the maximum observed ULP difference was 0 across all 200 fixtures for both implementations. The full test suite (test/test.js, test/test.native.js) was then run twice at ULP = 0 with identical, fully passing results (214 and 210 assertions respectively), confirming determinism.

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 a scheduled/automated session. The migration follows the idiom established in the already-migrated stats/base/dists/binomial/entropy, and the ULP bounds were measured empirically (via direct ULP-difference computation against the fixtures for both the JS and native implementations) rather than guessed.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01NbgTEygiUMqVkNd2aUhcoU


Generated by Claude Code

…tions

Resolves a part of #11352.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NbgTEygiUMqVkNd2aUhcoU

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: skipped
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@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 19, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/binomial/kurtosis $\\color{green}178/178$
$\\color{green}+100.00\\%$
$\\color{green}12/12$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}178/178$
$\\color{green}+100.00\\%$

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

Copy link
Copy Markdown
Member Author

⚠️ 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/binomial/kurtosis, 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

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.

3 participants