Skip to content

test: migrate stats/base/dists/cauchy/pdf to ULP-based assertions - #15349

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-cauchy-pdf
Draft

kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-cauchy-pdf

Conversation

@kgryte

@kgryte kgryte commented Sep 19, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Only test/test.factory.js carried the relative-tolerance idiom (delta/tol/EPS with t.ok( delta <= tol, ... )), across the three fixture loops. Those assertions are replaced with isAlmostSameValue, and the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires are removed in favor of @stdlib/assert/is-almost-same-value.

test/test.pdf.js and test/test.native.js already asserted exact equality via t.strictEqual and are intentionally left unchanged.

Final ULP constant: 0 (all three fixture loops).

This is the measured minimum. All 3000 fixture values — 1000 each across large_gamma, negative_median, and positive_median — compare bit-for-bit identical to the expected values, for both the factory and main entry points, so no nonzero ULP budget is required. This is consistent with test.pdf.js/test.native.js already relying on exact comparison, and matches the , 0 ) bound used by previously migrated packages in this family.

The bound was measured by exponential-then-binary search for the minimal passing N per fixture point, and the suite was then run three times at the final bound to confirm determinism (no FMA/arch variation).

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 notes:

  • test/test.js, test/test.pdf.js, and test/test.factory.js all pass (3018 assertions in the migrated file); test/test.native.js skips, as the native add-on is not built in this environment.
  • ESLint is clean on the changed file under the repository's test lint configuration, via the pre-commit hook.
  • The only changed file is test/test.factory.js.

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 authored by Claude Code as part of a batch migration of relative-tolerance tests to ULP-based assertions, mirroring the idiom established in previously merged packages in this family (e.g. stats/base/dists/cauchy/cdf). The ULP bound was measured rather than guessed.


@stdlib-js/reviewers


Generated by Claude Code

Migrate the relative-tolerance assertions in the `factory` tests to
ULP-difference assertions using `@stdlib/assert/is-almost-same-value`.

All 3000 fixture values (1000 each across the `large_gamma`,
`negative_median`, and `positive_median` fixtures) match the expected
values bit-for-bit, so the minimum required ULP bound is 0.

Ref: #11352

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

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/cauchy/pdf $\\color{green}293/293$
$\\color{green}+100.00\\%$
$\\color{green}19/19$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}293/293$
$\\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