Skip to content

test: migrate stats/base/dists/rayleigh/pdf to ULP-based assertions - #14267

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-rayleigh-pdf
Aug 14, 2026
Merged

test: migrate stats/base/dists/rayleigh/pdf to ULP-based assertions#14267
kgryte merged 1 commit into
developfrom
kgryte/ulp-rayleigh-pdf

Conversation

@kgryte

@kgryte kgryte commented Aug 14, 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/rayleigh/pdf from relative tolerance testing (delta <= tol, where tol = 3.0 * EPS * abs( expected[ i ] )) to ULP difference testing using @stdlib/assert/is-almost-same-value.
  • updates test/test.pdf.js, test/test.factory.js, and test/test.native.js. The expected[i] !== null fixture guards are left in place, and no fixtures, implementations, or other test cases were modified.
  • uses a ULP bound of 2 for every fixture loop (small_scale, medium_scale, large_scale) in all three test files. This is the measured minimum: the maximum observed ULP difference over the full fixture set (1000 values per fixture file, 3000 per test file) is exactly 2 for the JavaScript implementation, the factory-created function, and the C implementation alike. Tests fail at a bound of 1 (58 failing assertions) and pass at 2, and the full suite was run twice at the final bound to confirm determinism.

Test results for the package (per test file):

  • test/test.pdf.js: 3014 passing, 0 failing
  • test/test.factory.js: 3014 passing, 0 failing
  • test/test.native.js: 3014 passing, 0 failing (native add-on built locally, so these did not skip)
  • test/test.js: 3 passing, 0 failing

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.

The JavaScript and C implementations agree on the measured maximum ULP difference (2), so a single bound is used across test.pdf.js, test.factory.js, and test.native.js.

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 studied previously merged ULP migrations in the same family (e.g. stats/base/dists/gamma/pdf, stats/base/dists/laplace/pdf, stats/base/dists/uniform/logpdf) to mirror the established idiom, measured the minimum ULP bound empirically via @stdlib/number/float64/base/ulp-difference over the full fixture set, and verified the result by running the package test suite.


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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/rayleigh/pdf $\\color{green}295/295$
$\\color{green}+100.00\\%$
$\\color{green}29/29$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}295/295$
$\\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 14, 2026
@kgryte
kgryte marked this pull request as ready for review August 14, 2026 23:41
@kgryte
kgryte requested a review from a team August 14, 2026 23:41
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 14, 2026
@kgryte
kgryte merged commit 23dc0a0 into develop Aug 14, 2026
82 checks passed
@kgryte kgryte removed the Needs Review A pull request which needs code review. label Aug 14, 2026
@kgryte
kgryte deleted the kgryte/ulp-rayleigh-pdf branch August 14, 2026 23:43
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.

4 participants