Skip to content

test: migrate stats/base/dists/erlang/pdf to ULP-based assertions - #14787

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-erlang-pdf
Draft

test: migrate stats/base/dists/erlang/pdf to ULP-based assertions#14787
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-erlang-pdf

Conversation

@kgryte

@kgryte kgryte commented Aug 29, 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/erlang/pdf from relative tolerance testing to ULP difference testing.

Specifically, test/test.pdf.js and test/test.factory.js are updated to replace the delta/tol computation with @stdlib/assert/is-almost-same-value, and the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires are removed. The package has no C implementation, so there is no test/test.native.js to update, and test/test.js contains no tolerance-based assertions.

Three Julia fixtures are exercised (1000 cases each), and each is given its own bound, which is the measured minimum over that fixture:

Fixture Previous tolerance ULP bound Worst case
both_large.json 180.0 * EPS * abs( expected[ i ] ) 271 x = 4.522887156354011, k = 11, lambda = 29.25588256202781
large_shape.json 90.0 * EPS * abs( expected[ i ] ) 154 x = 0.0012734228532729208, k = 10, lambda = 5.668294773024138
large_rate.json 100.0 * EPS * abs( expected[ i ] ) 146 x = 3.805558533887737, k = 7, lambda = 18.90381811016824

The bounds are identical for main.js and factory.js, as the latter delegates to the same code path.

Each bound was tightened from a high starting value down to the smallest integer which still passes over the full fixture set. At one ULP lower (270/153/145), exactly one assertion fails per fixture, confirming the bounds are minimal. The suite was run twice at the final bounds to confirm the result is deterministic.

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 test files are modified; no source, documentation, or benchmark files are touched.

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 as part of an automated conversion task. The migration mirrors the idiom established in previously merged conversions (e.g. stats/base/dists/halfnormal/logpdf, stats/base/dists/triangular/pdf), and each ULP bound was determined empirically by measuring the per-fixture ULP difference and verifying that the next smaller bound fails.


@stdlib-js/reviewers


Generated by Claude Code

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/erlang/pdf $\\color{green}198/198$
$\\color{green}+100.00\\%$
$\\color{green}9/9$
$\\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.

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