Skip to content

test: migrate stats/base/dists/f/pdf to ULP-based assertions - #14853

Draft
aryan7071 wants to merge 1 commit into
stdlib-js:developfrom
aryan7071:test-migrate-f-pdf-ulp
Draft

test: migrate stats/base/dists/f/pdf to ULP-based assertions#14853
aryan7071 wants to merge 1 commit into
stdlib-js:developfrom
aryan7071:test-migrate-f-pdf-ulp

Conversation

@aryan7071

Copy link
Copy Markdown
Contributor

Resolves #11352

Description

What is the purpose of this pull request?

This pull request:

  • migrates the test suite for stats/base/dists/f/pdf from relative tolerance (abs/EPS-based) assertions to ULP difference assertions using @stdlib/assert/is-almost-same-value.
  • updates test/test.factory.js, test/test.native.js, and test/test.pdf.js. test/test.js contains no fixture-based numeric assertions and required no changes.
  • removes the now-unused abs and EPS imports and the corresponding delta/tol variable declarations, collapsing each if/else exact-match-or-tolerance branch into a single isAlmostSameValue assertion.

Each of the six fixture blocks (bothLarge, largeD1, largeD2 each tested against both Julia and Boost C++ reference values) required its own independently-determined minimum ULP bound; a single shared value was not sufficient across all six. Measured minimum ULP bounds:

Fixture Reference ULP
both_large Julia 4003
large_d1 Julia 95
large_d2 Julia 103
both_large Boost C++ 148
large_d1 Boost C++ 105
large_d2 Boost C++ 1285

Each bound is the exact maximum observed ULP difference over its fixture (1000+ cases each), so it is also the minimum bound that passes.

Two of these bounds are notably larger than the rest: both_large/Julia (4003) and large_d2/Boost C++ (1285). Both outlier cases occur at inputs where d1 is very close to 2.0 (d1=2.0068... and d1=2.2371... respectively) — a value this distribution already treats as a special boundary elsewhere in the test suite (the pdf has a removable discontinuity in its limiting behavior at d1=2, per the existing d1<2.0/d1=2.0/d1>2.0 boundary tests). Inspecting these two cases directly shows actual and expected values still agree closely in absolute/relative terms; the outsized ULP counts reflect the fine representable spacing of floating-point values in this region rather than a correctness issue.

The pre-existing "baseline case" test in test.native.js (a single hardcoded input/output check, unrelated to the six fixture-driven blocks above) already used isAlmostSameValue with ULP=2 prior to this PR and was not modified.

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.".

{{TODO: add disclosure if applicable}}


@stdlib-js/reviewers

@aryan7071
aryan7071 requested a review from a team August 31, 2026 18:59
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. labels Aug 31, 2026
@aryan7071
aryan7071 marked this pull request as draft August 31, 2026 19:08
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue)

2 participants