Skip to content

test: migrate stats/base/dists/cauchy/logcdf to ULP-based assertions - #15367

Closed
Planeshifter wants to merge 1 commit into
developfrom
philipp/ulp-stats-base-dists-cauchy-logcdf
Closed

Planeshifter wants to merge 1 commit into
developfrom
philipp/ulp-stats-base-dists-cauchy-logcdf

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 stats/base/dists/cauchy/logcdf from relative-tolerance (EPS-based) assertions to ULP-difference assertions, per the guidance in [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.

  • Replaces the var delta = abs( y - expected[ i ] ); var tol = <N> * EPS * abs( expected[ i ] ); t.ok( delta <= tol, ... ) pattern in test/test.logcdf.js, test/test.factory.js, and test/test.native.js with t.strictEqual( isAlmostSameValue( y, expected[ i ], <ulp> ), true, 'returns expected value' ), adding the @stdlib/assert/is-almost-same-value import to each file.

  • Uses the minimum required ULP value for each fixture block, determined by measuring the actual ULP difference between computed and expected values using @stdlib/number/float64/base/ulp-difference (verified by building and running the native addon locally, and running the full suite twice to confirm determinism):

    • large_gamma fixture: 9 ULP
    • negative_median fixture: 12 ULP
    • positive_median fixture: 6 ULP

    These bounds are identical across test.logcdf.js, test.factory.js, and test.native.js, since the JS and native (C) implementations produced identical outputs in local testing.

  • test/test.js was left unchanged, as it contains no tolerance-based assertions.

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

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 by Claude Code, run as an autonomous scheduled task on my account to work through the ULP migration tracking issue (#11352) one package at a time. It selected this package by scanning for the relative-tolerance idiom, studied prior converted packages (e.g., stats/base/dists/levy/logcdf, stats/base/dists/gumbel/cdf, stats/base/dists/negative-binomial/cdf) to mirror the established idiom, and empirically measured the tightest ULP bound for each fixture block rather than guessing.


@stdlib-js/reviewers


🤖 Generated with Claude Code

https://claude.ai/code/session_012tvj9d3aJCYgSsmTcKwDZ5


Generated by Claude Code

Replaces relative-tolerance (EPS-based) comparisons in the
fixture-driven test cases with `@stdlib/assert/is-almost-same-value`
ULP-difference assertions.

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

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/cauchy/logcdf $\\color{green}289/289$
$\\color{green}+100.00\\%$
$\\color{green}19/19$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}289/289$
$\\color{green}+100.00\\%$

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

Copy link
Copy Markdown
Member Author

⚠️ Issue Reference Review

An automated check found potentially unrelated issue/PR references in this PR:

Reference Assessment Reasoning
#11352 suspicious Issue #11352 is an RFC explicitly scoped to migrating math/base/special packages from relative-tolerance to ULP-based testing (its own instructions say to search for a package "in math/base/special"). This PR migrates tests for stats/base/dists/cauchy/logcdf, which is outside the issue's stated scope.

Why this matters: GitHub automatically closes issues referenced with
closing keywords (Resolves, Closes, Fixes) when the PR is merged. Incorrect
references can accidentally close unrelated issues.

What to do:

  • If the reference is correct, no action needed. This check may produce
    false positives.
  • If the reference is incorrect, please update your PR description.

This assessment was generated by an AI model and is informational only.


Generated by Claude Code

@kgryte kgryte added the autoclose: Already Resolved Pull request which should be auto-closed due proposed changes duplicating already included changes. label Sep 21, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Thank you for working on this pull request. However, we cannot accept your contribution as the issue this pull request seeks to resolve has already been addressed in a different pull request or commit.

Thank you again for your interest in stdlib, and we look forward to reviewing your future contributions.

@stdlib-bot stdlib-bot closed this Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autoclose: Already Resolved Pull request which should be auto-closed due proposed changes duplicating already included changes. 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