Skip to content

test: migrate stats/base/dists/geometric/logpmf to ULP-based assertions - #15543

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-geometric-logpmf
Sep 26, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-geometric-logpmf

Conversation

@kgryte

@kgryte kgryte commented Sep 25, 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 test suite for stats/base/dists/geometric/logpmf from relative tolerance assertions (delta <= tol, where tol = N * EPS * abs( expected )) to ULP difference assertions using @stdlib/assert/is-almost-same-value.
  • updates test/test.logpmf.js, test/test.factory.js, and test/test.native.js. test/test.js is unchanged, as it contains no tolerance-based assertions.
  • removes the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires from the updated test files.

ULP bounds

Each bound was tightened to the measured minimum over the full fixture set (1000 values per fixture):

Fixture Previous tolerance ULP bound Measured minimum
small_p.json 2.0 * EPS * abs( expected ) 1 1
large_p.json 1.5 * EPS * abs( expected ) 2 2

Notes on how the bounds were determined:

  • For every fixture value, the minimum ULP distance between the returned value and the expected value was computed, and the maximum over each fixture set was taken as the bound.
  • Lowering either bound by one causes failures (14 failing assertions across the fixture sets), so the values above are the tightest which pass.
  • The suite was run twice at the final bounds with identical results.
  • The C implementation was measured separately by compiling src/main.c (and its transitive C dependencies) into a standalone harness and evaluating the same fixtures. It produces bit-identical results to the JavaScript implementation at -O0, -O2, -O3, and -O3 -ffp-contract=fast, so test/test.native.js uses the same bounds.

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. Note that this environment could not complete make install-node-modules (the dependency tree currently fails to resolve es-object-atoms@^1.1.2, which is not published), so the package tests were run directly with tape and lint was run with the repository's etc/eslint/.eslintrc.tests.js configuration; the stdlib/jsdoc-markdown-remark rule had to be disabled locally because its mathjax-node-sre dependency was unavailable. That rule only applies to Markdown within JSDoc comments, which this pull request does not touch. Full CI verification is therefore deferred to the CI workflows.

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 written by Claude Code, running as an unattended task. The ULP bounds were measured empirically against the existing fixtures rather than guessed, and verified to be minimal.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_016qDBdX4stVDGqj5ywZ7uwf


Generated by Claude Code

…ions

Migrates the test suite for `stats/base/dists/geometric/logpmf` from
relative tolerance assertions to ULP difference assertions using
`@stdlib/assert/is-almost-same-value`.

The ULP bounds were tightened to the measured minimum over the full
fixture sets: 1 ULP for the small `p` fixtures and 2 ULP for the large
`p` fixtures (for both the JavaScript and C implementations).

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qDBdX4stVDGqj5ywZ7uwf
@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 25, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/geometric/logpmf $\\color{green}289/289$
$\\color{green}+100.00\\%$
$\\color{green}24/24$
$\\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.

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Sep 26, 2026
@kgryte
kgryte marked this pull request as ready for review September 26, 2026 02:17
@kgryte
kgryte requested a review from a team September 26, 2026 02:17
@kgryte
kgryte merged commit afb1781 into develop Sep 26, 2026
66 checks passed
@kgryte
kgryte deleted the kgryte/ulp-geometric-logpmf branch September 26, 2026 02:18
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Sep 26, 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