Skip to content

test: migrate stats/base/dists/logistic/cdf to ULP-based assertions - #14607

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-a2eaxs
Aug 25, 2026
Merged

kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-a2eaxs

Conversation

@kgryte

@kgryte kgryte commented Aug 25, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Changes are confined to the package's test files (test/test.cdf.js, test/test.factory.js, test/test.native.js):

  • adds the @stdlib/assert/is-almost-same-value require and removes the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.
  • removes the delta/tol declarations and the if ( y === expected[i] ) { ... } else { ... } tolerance branch.
  • replaces each fixture-loop assertion with t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );.

No implementation, fixture, or documentation files are touched, and no test cases were added, removed, or otherwise altered.

ULP bound

All nine converted assertion loops use an ULP value of 0, which is the tightest bound possible.

The bound was measured rather than guessed: computing @stdlib/number/float64/base/ulp-difference between each computed value and its expected fixture value across the full fixture set (positive_mean.json, negative_mean.json, large_variance.json; 1000 values each, 3000 total) yields a maximum observed ULP difference of 0 for the main export, for the function returned by factory, and for the native C implementation. In other words, every fixture value is reproduced exactly.

Verification:

  • test/test.cdf.js — 3016 assertions, all passing.
  • test/test.factory.js — 3019 assertions, all passing.
  • test/test.native.js — 3016 assertions, all passing. The native add-on was built locally so that these tests actually executed rather than being skipped.
  • The full suite was run twice at the final ULP value with identical results, to confirm the bound is not sensitive to FMA/architecture-dependent rounding.
  • ESLint (etc/eslint/.eslintrc.tests.js) reports no problems for the three changed files.

This mirrors the bound used by the already-merged sibling packages stats/base/dists/weibull/cdf (#14281) and stats/base/dists/normal/cdf (#14274).

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.

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 unattended scheduled task. It studied the previously merged ULP migrations (in particular the sibling packages stats/base/dists/weibull/cdf and stats/base/dists/normal/cdf) to match the established idiom, applied the mechanical test conversion, and empirically measured the minimum ULP bound and ran the test suite to verify it.


@stdlib-js/reviewers


Generated by Claude Code

Ref: #11352

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

---
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 Good First PR A pull request resolving a Good First Issue. Statistics Issue or pull request related to statistical functionality. labels Aug 25, 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/logistic/cdf $\\color{green}273/273$
$\\color{green}+100.00\\%$
$\\color{green}25/25$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}273/273$
$\\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 25, 2026
@kgryte
kgryte marked this pull request as ready for review August 25, 2026 03:44
@kgryte
kgryte requested a review from a team August 25, 2026 03:44
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 25, 2026
@kgryte
kgryte merged commit bfc0a80 into develop Aug 25, 2026
82 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-a2eaxs branch August 25, 2026 03:45
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 25, 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