Skip to content

test: migrate stats/base/dists/chisquare/median to ULP-based assertions - #14545

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-7wj7hs
Aug 23, 2026
Merged

kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-7wj7hs

Conversation

@kgryte

@kgryte kgryte commented Aug 23, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates stats/base/dists/chisquare/median tests from relative tolerance testing to ULP difference testing.
  • replaces var delta/var tol tolerance math (previously tol = 25.0 * EPS * abs( expected[ i ] )) and the associated t.ok( delta <= tol, ... ) assertion with t.strictEqual( isAlmostSameValue( y, expected[ i ], 39 ), true, 'returns expected value' );.
  • adds the @stdlib/assert/is-almost-same-value require and drops the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.

Only test/test.js is modified; the package has no test/test.native.js.

Final ULP constant: 39 for the test/test.js fixture loop (test/fixtures/julia/data.json, 50 values).

Measured minimum: 39 is the tightest bound. Running the package test suite at 38 fails one assertion (worst case: k = 0.20785020415982736, returned 0.0015467191018913129 vs. expected 0.0015467191018913044); 39 passes all 55 assertions. The suite was run twice at 39 to confirm the result is deterministic on this machine.

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.

No.

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: it selected the package, studied already-migrated packages to mirror the project's idiom, applied the test changes, and searched for the minimum passing ULP bound by running the package test suite.


@stdlib-js/reviewers


Generated by Claude Code

…ions

Replace the relative tolerance assertions in the fixture loop with
`@stdlib/assert/is-almost-same-value` ULP difference assertions. The ULP
bound was tightened to the measured minimum which passes over the full
fixture set (39 ULP; 38 ULP fails).

Resolves a part of #11352.

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/chisquare/median $\\color{green}100/100$
$\\color{green}+100.00\\%$
$\\color{green}3/3$
$\\color{green}+100.00\\%$
$\\color{green}1/1$
$\\color{green}+100.00\\%$
$\\color{green}100/100$
$\\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 Aug 23, 2026
@kgryte
kgryte marked this pull request as ready for review August 23, 2026 08:51
@kgryte
kgryte requested a review from a team August 23, 2026 08:51
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 23, 2026
@kgryte
kgryte merged commit 209e1e0 into develop Aug 23, 2026
75 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-7wj7hs branch August 23, 2026 08:52
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 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