Skip to content

test: migrate stats/base/dists/frechet/stdev to ULP-based assertions - #15163

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-frechet-stdev
Sep 11, 2026
Merged

test: migrate stats/base/dists/frechet/stdev to ULP-based assertions#15163
kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-frechet-stdev

Conversation

@kgryte

@kgryte kgryte commented Sep 11, 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/frechet/stdev from relative tolerance testing to ULP difference testing.
  • replaces the delta/tol computations in test/test.js and test/test.native.js with t.strictEqual( isAlmostSameValue( y, expected[ i ], 12 ), true, 'returns expected value' );.
  • adds the @stdlib/assert/is-almost-same-value import and removes the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps imports.

The ULP bound was tightened to the measured minimum:

File ULP constant Notes
test/test.js 12 measured maximum ULP difference over all 68 non-null fixture cases is exactly 12; the suite fails at 11 (1 failing assertion) and passes at 12.
test/test.native.js 12 the C implementation is bit-for-bit identical to the JavaScript implementation over the full fixture set, so the same bound applies.

The previous assertions used a relative tolerance of 10.0 * EPS, which is consistent with the measured 12 ULP bound.

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.

Verification notes:

  • test/test.js passes (83/83 assertions), and the suite was run twice at the final ULP value to confirm determinism.
  • The measured minimum was established by computing number/float64/base/ulp-difference between the returned values and the Julia fixture values for every fixture case, and confirmed empirically by running the suite at 11 (fails) and 12 (passes).
  • Because the native add-on is not built in this environment, test/test.native.js skips. To bound the native ULP value, src/main.c and its transitive C dependencies were compiled into a standalone harness and evaluated over the same fixture set at -O0, -O2, and -O3. In all three cases the C results were bit-for-bit identical to the JavaScript results and the maximum ULP difference versus the fixtures was 12, so no FMA/optimization-level sensitivity was observed.
  • Linting is clean for both changed files under etc/eslint/.eslintrc.tests.js (0 errors). The only warnings are pre-existing @cspell "Unknown word: échet" warnings on the unchanged test description strings.
  • Only the two test files are changed.

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. The test migration mirrors the idiom established in the already-merged conversion for the sibling package stats/base/dists/frechet/median (#15123), and the ULP bound was measured rather than guessed.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01NVM4G3stpWkuj632fLHnYP


Generated by Claude Code

Replace relative tolerance assertions with `isAlmostSameValue` ULP
comparisons. The measured minimum ULP bound over the full Julia fixture
set is 12 for both the JavaScript and native implementations.

Ref: #11352

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/frechet/stdev $\\color{green}198/198$
$\\color{green}+100.00\\%$
$\\color{green}13/13$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}198/198$
$\\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 11, 2026
@kgryte
kgryte marked this pull request as ready for review September 11, 2026 17:25
@kgryte
kgryte requested a review from a team September 11, 2026 17:25
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 11, 2026
@kgryte
kgryte merged commit 08ba15f into develop Sep 11, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-stats-base-dists-frechet-stdev branch September 11, 2026 17:26
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 11, 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.

2 participants