Skip to content

test: migrate stats/base/dists/frechet/logpdf to ULP-based assertions - #14851

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-stats-base-dists-frechet-logpdf
Draft

test: migrate stats/base/dists/frechet/logpdf to ULP-based assertions#14851
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-stats-base-dists-frechet-logpdf

Conversation

@kgryte

@kgryte kgryte commented Aug 31, 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/logpdf from relative tolerance testing (delta <= N * EPS * abs( expected )) to ULP difference testing using @stdlib/assert/is-almost-same-value.

The following files are updated, each containing the same three Julia fixture loops:

File large_shape.json large_scale.json both_large.json
test/test.logpdf.js 2 2 25
test/test.factory.js 2 2 25
test/test.native.js 2 2 25

Each bound is the measured minimum over the full fixture set (1000 cases per fixture, 3000 cases per file). Lowering the bounds by one ULP fails: large_shape yields 34 failures at 1, large_scale yields 30 failures at 1, and both_large yields 1 failure at 24.

The JavaScript, factory, and C implementations were each measured independently and agree exactly on all three bounds, so a single set of values is used across the three files.

Only the three test files are changed; no implementation, documentation, or fixture files are touched.

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 performed locally:

test.js          3 passing
test.logpdf.js   3024 passing
test.factory.js  3021 passing
test.native.js   3024 passing

eslint --config etc/eslint/.eslintrc.tests.js (all four test files)
  clean

The native add-on was built locally so that test/test.native.js actually executed rather than being skipped. The full suite was run twice at the final bounds to confirm the results are deterministic, and the add-on was additionally rebuilt with CFLAGS="-ffp-contract=off" to confirm the C bounds are not sensitive to FMA contraction (identical bounds in both builds).

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. The agent studied previously merged conversions under this tracking issue (in particular the sibling package stats/base/dists/frechet/logcdf) to match the established idiom, applied the migration, and determined the minimum ULP bounds empirically by computing the exact per-element ULP distance across the fixture set and confirming failures one ULP below each bound.


@stdlib-js/reviewers

@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 31, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/frechet/logpdf $\\color{green}326/326$
$\\color{green}+100.00\\%$
$\\color{green}27/27$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}326/326$
$\\color{green}+100.00\\%$

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

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