Skip to content

test: migrate stats/base/dists/logistic/median to ULP-based assertions - #15999

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-logistic-median
Oct 11, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-logistic-median

Conversation

@kgryte

@kgryte kgryte commented Oct 9, 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 tests for stats/base/dists/logistic/median from relative tolerance testing to ULP difference testing.
  • replaces the delta/tol computation and the t.ok( delta <= tol, ... ) assertion with t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );.
  • adds a @stdlib/assert/is-almost-same-value import and removes the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps imports.

The final ULP constant is 0, which is the measured minimum. Starting from a high bound and tightening, every one of the 100 non-null fixture values in test/fixtures/julia/data.json matches the returned value bitwise, so no ULP slack is required. This matches the bound used in the sibling package stats/base/dists/logistic/mode (#15597). The test suite was run twice at the final bound to confirm determinism (110 passing, 0 failing on both runs).

Only test/test.js is changed. test/test.native.js contains no relative tolerance assertions (it compares the returned value against mu[i] exactly), so it is left untouched, consistent with the sibling logistic/mode migration.

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 performed locally:

  • make test TESTS_FILTER=".*/stats/base/dists/logistic/median/.*" → 110 passing, 0 failing (run twice).
  • eslint -c etc/eslint/.eslintrc.tests.js on the changed file → clean.

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. The migration mirrors the idiom established in the already-merged sibling migration (#15597), and the minimum ULP bound was measured empirically over the full fixture set rather than assumed.


@stdlib-js/reviewers


Generated by Claude Code

Replace relative tolerance assertions with ULP difference assertions
using `@stdlib/assert/is-almost-same-value`. All one hundred fixture
values match bitwise, 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_012Nh3iDy9gFehtejnTZ9Gg1
@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 Oct 9, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/logistic/median $\\color{green}175/175$
$\\color{green}+100.00\\%$
$\\color{green}9/9$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}175/175$
$\\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 Oct 11, 2026
@kgryte
kgryte marked this pull request as ready for review October 11, 2026 12:44
@kgryte
kgryte requested a review from a team October 11, 2026 12:44
@kgryte
kgryte merged commit ea3ed5a into develop Oct 11, 2026
66 checks passed
@kgryte
kgryte deleted the kgryte/ulp-logistic-median branch October 11, 2026 12:44
@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 Oct 11, 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