Skip to content

test: migrate stats/base/dists/weibull/stdev to ULP-based assertions - #14469

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-weibull-stdev
Aug 21, 2026
Merged

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

Conversation

@kgryte

@kgryte kgryte commented Aug 21, 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 @stdlib/stats/base/dists/weibull/stdev from relative-tolerance assertions to ULP-based assertions using @stdlib/assert/is-almost-same-value, per the guidance in [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • updates both test/test.js and test/test.native.js to mirror the idiom used in previously converted packages (e.g. stats/base/dists/chi/stdev, stats/base/dists/erlang/stdev, stats/base/dists/frechet/variance).
  • replaces the previous 170.0 * EPS * abs( expected[ i ] ) (test/test.js) and 180.0 * EPS * abs( expected[ i ] ) (test/test.native.js) tolerance loops with t.strictEqual( isAlmostSameValue( y, expected[ i ], 277 ), true, 'returns expected value' ).
  • drops the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.

The tightest ULP bound was determined empirically by measuring the maximum ULP difference over the full 500-value Julia fixture set:

  • test/test.js: N = 277 ULP. The measured maximum ULP difference over the fixtures is exactly 277; the worst case is k = 10.905349225171449, lambda = 1.9805794474478602, where stdev( k, lambda ) returns 0.2095944993595373 against an expected value of 0.20959449935952962. Lowering the bound to 276 fails that fixture, so 277 is the minimum passing integer.
  • test/test.native.js: N = 277 ULP. The native add-on was built locally for this package, and the maximum ULP difference for the C implementation over the same fixtures is likewise exactly 277, so the bound matches the JavaScript implementation.

Both test/test.js and test/test.native.js were run twice at the final N = 277 (514 assertions each, all passing, with the native add-on built so the native tests were not skipped) to confirm the bound is deterministic.

Only the two test files are changed.

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

This PR was authored by Claude Code (Anthropic) running as an unattended scheduled task. The conversion mirrors the exact idiom used in previously merged ULP migrations authored by the PR author (e.g. #14447, #14457), and the ULP bound was measured empirically against the existing Julia fixtures and confirmed tight (276 fails, 277 passes) for both the JavaScript and the locally built C implementation.


@stdlib-js/reviewers


Generated by Claude Code

Ref: #11352

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: skipped
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@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 21, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

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