Skip to content

test: migrate stats/base/dists/weibull/pdf to ULP-based assertions - #14852

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-weibull-pdf
Sep 1, 2026
Merged

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

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/weibull/pdf 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 both_large.json large_scale.json large_shape.json
test/test.pdf.js 0 0 0
test/test.factory.js 0 0 0
test/test.native.js 0 0 0

Each bound is the measured minimum over the full fixture set (1000 cases per fixture, 3000 cases per file). 0 is the tightest bound the assertion admits: at 0, isAlmostSameValue reduces to the SameValue algorithm, so every returned value matches its Julia-generated expected value bit-for-bit, and no case relies on any tolerance. The previous relative tolerances (1.0 * EPS, and 2.0 * EPS for one loop in test/test.native.js) were therefore never exercised.

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.pdf.js      3023 passing
test.factory.js  3028 passing
test.native.js   3023 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).

Note on the local environment: make install-node-modules could not complete in the sandbox used to author this change, because a transitive development dependency resolves to es-object-atoms@^1.1.2, which is not published on the registry. The test runner, ESLint (with the project's .eslintrc.tests.js configuration and the stdlib plugin), and node-gyp were installed separately so that the checks above could be run; the editorconfig-checker and production license pre-commit/pre-push hooks could not run, since both fetch artifacts that are unreachable from the sandbox. EditorConfig conformance for the three changed files (LF endings, UTF-8, tab indentation, no trailing whitespace, final newline) was verified manually instead.

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/weibull/cdf) 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 for the JavaScript, factory, and native implementations.


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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/weibull/pdf $\\color{green}310/310$
$\\color{green}+100.00\\%$
$\\color{green}36/36$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}310/310$
$\\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 Sep 1, 2026
@kgryte
kgryte marked this pull request as ready for review September 1, 2026 10:06
@kgryte
kgryte requested a review from a team September 1, 2026 10:06
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 1, 2026
@kgryte
kgryte merged commit 88fd76a into develop Sep 1, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-stats-base-dists-weibull-pdf branch September 1, 2026 10:07
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 1, 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.

3 participants