Skip to content

test: migrate stats/base/dists/bernoulli/mean to ULP-base assertions - #14832

Merged
kgryte merged 1 commit into
stdlib-js:developfrom
AryanSharma48:ulp-bernoulli-mean
Aug 30, 2026
Merged

test: migrate stats/base/dists/bernoulli/mean to ULP-base assertions#14832
kgryte merged 1 commit into
stdlib-js:developfrom
AryanSharma48:ulp-bernoulli-mean

Conversation

@AryanSharma48

Copy link
Copy Markdown
Contributor

Resolves a part of #11352 .

Description

What is the purpose of this pull request?

This pull request:

  • migrates test/test.js and test/test.native.js of stats/base/dists/bernoulli/mean from relative-tolerance (EPS-based) assertions to ULP-difference assertions via @stdlib/assert/is-almost-same-value.
  • replaces the if ( y === expected[i] ) {...} else { delta = abs(...); tol = 1.0*EPS*abs(...); t.ok( delta <= tol, ... ) } branch with t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ).
  • removes the now-unused abs and EPS requires.
  • the ULP bound was set to 1 by measuring the actual ULP difference between mean() output and the fixture-expected values across all 1000 fixtures; the maximum observed difference was within 1 ULP (the implementation is a simple identity computation returning p, which reproduces the Julia fixture values), so the ULP bound is set to 1. This mirrors the existing convention used for other simple-formula distribution functions in this codebase. The full suite (1007 assertions per implementation) was run to confirm deterministic results.

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.".


@stdlib-js/reviewers

Signed-off-by: Aryan Sharma <aryansharma24106@gmail.com>
@AryanSharma48
AryanSharma48 requested a review from a team August 30, 2026 22:39
@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. Needs Review A pull request which needs code review. labels Aug 30, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/bernoulli/mean $\\color{green}165/165$
$\\color{green}+100.00\\%$
$\\color{green}9/9$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}165/165$
$\\color{green}+100.00\\%$

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

@kgryte kgryte added difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. Tests Pull requests specifically adding tests. review: 5 and removed Needs Review A pull request which needs code review. labels Aug 30, 2026
@kgryte
kgryte merged commit 69174e0 into stdlib-js:develop Aug 30, 2026
113 checks passed
@Planeshifter Planeshifter mentioned this pull request Aug 31, 2026
1 task
kgryte pushed a commit that referenced this pull request Sep 1, 2026
PR-URL: #14849
Reviewed-by: Athan Reines <kgryte@gmail.com>
Ref: #14832
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. Good First PR A pull request resolving a Good First Issue. review: 5 Statistics Issue or pull request related to statistical functionality. Tests Pull requests specifically adding tests.

3 participants