Skip to content

test: migrate stats/base/dists/rayleigh/entropy to ULP-based assertions - #15162

Draft
Planeshifter wants to merge 1 commit into
developfrom
philipp/ulp-rayleigh-entropy
Draft

test: migrate stats/base/dists/rayleigh/entropy to ULP-based assertions#15162
Planeshifter wants to merge 1 commit into
developfrom
philipp/ulp-rayleigh-entropy

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • Migrates the test suite for @stdlib/stats/base/dists/rayleigh/entropy from relative-tolerance testing to ULP (units in the last place) based assertions, per the migration described in [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • Replaces the delta/tol relative-tolerance comparison (and the now-dead exact-match branch) in the fixture-driven test with a single t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); assertion, mirroring the idiom used in already-converted sibling packages (e.g. stats/base/dists/rayleigh/pdf, rayleigh/cdf, rayleigh/logcdf, rayleigh/quantile, rayleigh/variance).
  • Applies the change to both test/test.js and test/test.native.js. No other files are changed.
  • The measured minimum ULP bound required for the full 50-value fixture set to pass is 1, for both the JavaScript implementation and the native C implementation (built locally via node-gyp rebuild so test/test.native.js was actually exercised rather than skipped). A bound of 0 fails 6 assertions in each file.

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 on linux/x64, Node.js v22:

  • test/test.js — 56 passing, 0 failing
  • test/test.native.js — 56 passing, 0 failing (native add-on built locally)
  • The full suite was run three times at the final bound (1) with identical results, confirming no FMA/architecture-dependent flakiness locally.
  • npx eslint and make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/rayleigh/entropy/.*" are both clean for the changed files.
  • The only files changed are the two test files.

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 primarily by Claude Code, running as an unattended scheduled task. It searched the repository for packages still using the relative-tolerance test idiom, studied the git history of several already-converted packages in the same distribution family (e.g. stats/base/dists/rayleigh/pdf, rayleigh/variance) to mirror the established idiom, applied the conversion, and determined the minimum ULP bound by computing the exact ULP distance between actual and expected values across the fixture set for both the JS and native implementations.


@stdlib-js/reviewers


🤖 Generated with Claude Code

https://claude.ai/code/session_01HPZpFvV75WUR79qSe8Katc


Generated by Claude Code

Replaces the relative-tolerance (EPS/delta/tol) comparison in the
fixture-driven test with `@stdlib/assert/is-almost-same-value`, matching
the idiom used in previously converted sibling packages (e.g.,
stats/base/dists/rayleigh/pdf, rayleigh/cdf). Applies to both
test/test.js and test/test.native.js.

The minimum required ULP bound was measured empirically by computing the
ULP distance between actual and expected values across the full fixture
set for both the JavaScript and native implementations: max observed
diff is 1 ULP for both. Verified that a bound of 0 fails (6 assertions)
and 1 passes deterministically across repeated runs.

Resolves a part of #11352.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HPZpFvV75WUR79qSe8Katc

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

Copy link
Copy Markdown
Contributor

Hello! 👋

We've noticed that you've been opening a number of PRs addressing good first issues. Thank you for your interest and enthusiasm!

Now that you've made a few contributions, we suggest no longer working on good first issues. Instead, we encourage you to prioritize cleaning up any PRs which have yet to be merged and then proceed to work on more involved tasks.

Not only does this ensure that other new contributors can work on things and get ramped up on all things stdlib, it also ensures that you can spend your time on more challenging problems. 🚀

For ideas for future PRs, feel free to search the codebase for TODOs and FIXMEs and be sure to check out other open issues on the issue tracker. Cheers!

@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/rayleigh/entropy $\\color{green}164/164$
$\\color{green}+100.00\\%$
$\\color{green}8/8$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}164/164$
$\\color{green}+100.00\\%$

The above coverage report was generated for the changes in this PR.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants