Skip to content

test: migrate stats/base/dists/weibull/logcdf to ULP-based assertions - #14109

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-weibull-logcdf
Aug 10, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-weibull-logcdf

Conversation

@kgryte

@kgryte kgryte commented Aug 9, 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/weibull/logcdf from relative tolerance testing to ULP difference testing, replacing the delta/tol comparisons in test/test.logcdf.js, test/test.factory.js, and test/test.native.js with isAlmostSameValue.
  • adds the @stdlib/assert/is-almost-same-value import and removes the now unused @stdlib/constants/float64/eps and @stdlib/math/base/special/abs imports.

Final ULP constant: 0 for every fixture group, in all three test files.

The ULP bound was tightened by measuring the maximum ULP difference over the full fixture set (3 fixture groups × 1000 values per test file) rather than by guessing: starting from a high bound and bisecting down to the minimum integer which still passes. Both the JavaScript and C implementations reproduce every Julia fixture value exactly, so the measured minimum is 0 ULP for all of:

Fixture Values Previous tolerance Measured max ULP diff ULP constant
both_large 1000 1.0*EPS 0 0
large_shape 1000 1.0*EPS 0 0
large_scale 1000 1.0*EPS 0 0

test/test.native.js was verified against a locally compiled add-on (not skipped), so the 0 ULP bound is measured for the C implementation as well, not merely inherited from the JavaScript results. Each suite was run twice at the final bound to confirm determinism; all assertions pass on every run (test.logcdf.js: 3021, test.factory.js: 3026, test.native.js: 3021, test.js: 3).

Only the three test files are changed; the implementation and fixtures are untouched.

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.

Opened as a draft pending maintainer review of the 0 ULP bound. A bound of 0 requires bit-for-bit agreement with the fixtures; there is existing precedent for this in the repo (e.g. stats/base/dists/uniform/entropy, math/base/special/covercos, math/base/special/asec all use 0 for fixture groups which match exactly), and the JavaScript results are deterministic IEEE-754. If maintainers would prefer a 1 ULP margin in test/test.native.js as a hedge against compiler/architecture variation in the C build, that is a one-character change.

Note: the editorconfig-checker stage of the local pre-commit hook could not run in this environment because it downloads its binary from GitHub releases, which was blocked. EditorConfig conformance was instead verified manually for the changed files (LF line endings, UTF-8, tab indentation, no trailing whitespace, final newline present), and make lint-javascript-tests passes cleanly for the package.

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 written by Claude Code running as an unattended scheduled task: it selected the package, studied prior conversions in the repo to match the established idiom, applied the test migration, measured the minimum ULP bound empirically, and verified tests and linting locally.


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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/weibull/logcdf $\\color{green}311/311$
$\\color{green}+100.00\\%$
$\\color{green}28/28$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}311/311$
$\\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 10, 2026
@kgryte
kgryte marked this pull request as ready for review August 10, 2026 00:05
@kgryte
kgryte requested a review from a team August 10, 2026 00:05
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 10, 2026
@kgryte
kgryte merged commit 5ee4874 into develop Aug 10, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-weibull-logcdf branch August 10, 2026 00:06
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 10, 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.

3 participants