Skip to content

test: migrate stats/base/dists/binomial/skewness to ULP-based assertions - #15427

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-binomial-skewness
Sep 23, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-binomial-skewness

Conversation

@kgryte

@kgryte kgryte commented Sep 22, 2026

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/skewness from relative tolerance assertions to ULP difference assertions using @stdlib/assert/is-almost-same-value.
  • updates both test/test.js and test/test.native.js, replacing the delta/tol comparison against 2.0 * EPS * abs( expected[i] ) with t.strictEqual( isAlmostSameValue( y, expected[ i ], 2 ), true, 'returns expected value' ); and dropping the now-unused abs and EPS requires.

ULP bound

The ULP constant for both test files is 2, which is the measured minimum over the full Julia fixture set (200 cases):

Implementation N = 0 N = 1 N = 2
JavaScript 33 failures 6 failures 0 failures
C (native) 33 failures 6 failures 0 failures

The JavaScript and C implementations return bit-identical results for all 200 fixture cases, so a single bound applies to both test files. The worst case is n = 41, p = 0.21346557492605323, where the returned value 0.21841983899845177 differs from the expected 0.21841983899845172 by 2 ULP.

The native addon was compiled locally so that test/test.native.js executed against the C implementation rather than being skipped. The suite was run twice at N = 2 to confirm determinism (423 passing assertions across both test files on each run, no failures).

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.

Only the two test files are changed. make test TESTS_FILTER=".*/stats/base/dists/binomial/skewness/.*" is green, and both files lint cleanly under etc/eslint/.eslintrc.tests.js. The EditorConfig linter could not be run in this environment because its binary could not be downloaded, so EditorConfig compliance (LF line endings, UTF-8, tab indentation, no trailing whitespace, final newline) was verified manually instead.

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 primarily by Claude Code, which also measured the minimum ULP bound empirically against the fixture set and ran the test suite.


@stdlib-js/reviewers


Generated by Claude Code

…tions

Replace relative tolerance assertions with ULP difference assertions via
`@stdlib/assert/is-almost-same-value` in both the JavaScript and native
test suites. The ULP bound was tightened to the measured minimum of `2`
over the full Julia fixture set for both implementations.

Ref: #11352

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/binomial/skewness $\\color{green}177/177$
$\\color{green}+100.00\\%$
$\\color{green}12/12$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}177/177$
$\\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 Sep 23, 2026
@kgryte
kgryte marked this pull request as ready for review September 23, 2026 06:25
@kgryte
kgryte requested a review from a team September 23, 2026 06:25
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. labels Sep 23, 2026
@kgryte
kgryte merged commit c3350e9 into develop Sep 23, 2026
99 checks passed
@kgryte
kgryte deleted the kgryte/ulp-binomial-skewness branch September 23, 2026 06:25
@stdlib-bot stdlib-bot added Good First PR A pull request resolving a Good First Issue. and removed Needs Review A pull request which needs code review. labels Sep 23, 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