Skip to content

refactor: remove unneeded isnan checks#11693

Merged
kgryte merged 1 commit intodevelopfrom
philipp/drift-stats-base-dists-hypergeometric-2026-04-21
Apr 22, 2026
Merged

refactor: remove unneeded isnan checks#11693
kgryte merged 1 commit intodevelopfrom
philipp/drift-stats-base-dists-hypergeometric-2026-04-21

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

@Planeshifter Planeshifter commented Apr 21, 2026

Description

What is the purpose of this pull request?

This pull request

  • removes a redundant isnan(N)||isnan(K)||isnan(n) guard and the associated @stdlib/math/base/assert/is-nan require from stats/base/dists/hypergeometric/mean. All other packages in the distribution namespace rely solely on the !isNonNegativeInteger predicate to reject NaN inputs — !isNonNegativeInteger(NaN) is true.

Related Issues

Does this pull request have any related issues?

No.

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.

Output of a cross-package drift-detection routine over a randomly selected stdlib namespace (stats/base/dists/hypergeometric, seed 1776774012099). See the local drift report for the full per-feature tally, excluded findings, and agent verdicts. Draft PR: a maintainer should audit before promoting to ready-for-review.

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

Claude Code executed a cross-package drift-detection routine that randomly selected the stats/base/dists/hypergeometric namespace (seed 1776774012099), extracted structural and semantic features across the 11 sibling packages, computed majority patterns, and identified outliers. Three validation agents (opus × 2, sonnet × 1) independently verified each drift candidate; only findings classified as confirmed-drift by all relevant agents were applied as mechanical, behavior-preserving patches. A maintainer must audit before promoting from draft.


@stdlib-js/reviewers

… conventions

Dropped the redundant `isnan(N)||isnan(K)||isnan(n)` guard block at the
top of `mean()`; `!isNonNegativeInteger()` already rejects NaN, matching
the 7-guard validation prologue used by `kurtosis`, `mode`, `skewness`,
and `variance` (80% of hypergeometric moment-computing siblings with
explicit validation). Also removed the now-unused `@stdlib/math/base/assert/is-nan`
require. Behavior is preserved — NaN inputs still return NaN.
@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Apr 21, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/hypergeometric/mean $\color{green}194/194$
$\color{green}+100.00%$
$\color{green}13/13$
$\color{green}+100.00%$
$\color{green}2/2$
$\color{green}+100.00%$
$\color{green}194/194$
$\color{green}+100.00%$

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

@Planeshifter Planeshifter changed the title refactor: align stats/base/dists/hypergeometric/mean with namespace conventions refactor: remove unneeded isnan checks Apr 22, 2026
@Planeshifter Planeshifter marked this pull request as ready for review April 22, 2026 00:18
@Planeshifter Planeshifter requested review from a team and kgryte April 22, 2026 00:18
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Apr 22, 2026
@kgryte kgryte removed the Needs Review A pull request which needs code review. label Apr 22, 2026
@kgryte kgryte merged commit 80a434f into develop Apr 22, 2026
62 checks passed
@kgryte kgryte deleted the philipp/drift-stats-base-dists-hypergeometric-2026-04-21 branch April 22, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants