Skip to content

test: migrate stats/base/dists/discrete-uniform/logcdf to ULP-based assertions - #15415

Merged
Planeshifter merged 2 commits into
developfrom
kgryte/ulp-discrete-uniform-logcdf
Sep 22, 2026
Merged

Planeshifter merged 2 commits into
developfrom
kgryte/ulp-discrete-uniform-logcdf

Conversation

@kgryte

@kgryte kgryte commented Sep 22, 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/discrete-uniform/logcdf from relative tolerance (EPS-scaled) assertions to ULP difference assertions using @stdlib/assert/is-almost-same-value.

The following test files were updated:

  • test/test.logcdf.js
  • test/test.factory.js
  • test/test.native.js

In each file, the delta/tol computation and the t.ok( delta <= tol, ... ) assertion were replaced with t.strictEqual( isAlmostSameValue( y, expected[ i ], <ULP> ), true, 'returns expected value' ), and the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps imports were removed.

ULP bounds

The ULP values are the measured minimums over the full fixture sets. The maximum observed ULP difference was computed for the main export, the factory-created function, and the native implementation; all three agreed exactly, so the same bound is used per fixture set across all three test files:

Fixture Previous tolerance ULP bound (measured minimum)
small_range.json 110.0 * EPS 41
medium_range.json 80.0 * EPS 100
large_range.json 150.0 * EPS 156

Each bound is tight: the worst-case fixture element in each set differs from the expected value by exactly that number of ULP, so lowering any bound by one causes the corresponding test to fail.

The suite was run twice at the final ULP values to confirm determinism, with the native add-on built so that test/test.native.js executed rather than being skipped:

test/test.logcdf.js    3011 passing
test/test.factory.js   3017 passing
test/test.js              3 passing
test/test.native.js    3006 passing

Only test files are changed; no source, documentation, benchmark, or fixture files were 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.

The sibling package stats/base/dists/discrete-uniform/cdf was used as the reference for the conversion idiom.

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 running as an automated task. The conversion follows the idiom established by previously merged packages, the ULP bounds were measured empirically against the existing fixtures, and the test suite and ESLint were run locally before submission.


@stdlib-js/reviewers


Generated by Claude Code

… assertions

Ref: #11352

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

---
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 the Good First PR A pull request resolving a Good First Issue. label Sep 22, 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 stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Sep 22, 2026
@stdlib-bot

stdlib-bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/discrete-uniform/logcdf $\\color{green}305/305$
$\\color{green}+0.00\\%$
$\\color{green}31/31$
$\\color{green}+0.00\\%$
$\\color{green}4/4$
$\\color{green}+0.00\\%$
$\\color{green}305/305$
$\\color{green}+0.00\\%$

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

@Planeshifter
Planeshifter marked this pull request as ready for review September 22, 2026 04:13
@Planeshifter
Planeshifter requested a review from a team September 22, 2026 04:13
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 22, 2026
@Planeshifter

Copy link
Copy Markdown
Member

/stdlib merge

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Sep 22, 2026
@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Sep 22, 2026

@Planeshifter Planeshifter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Planeshifter
Planeshifter merged commit 0f2be6e into develop Sep 22, 2026
15 checks passed
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 22, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants