Skip to content

bench: adopt y != y NaN check across stats/base/dists/* C benchmarks#13229

Draft
Planeshifter wants to merge 1 commit into
developfrom
philipp/fix-propagation-2026-07-02
Draft

bench: adopt y != y NaN check across stats/base/dists/* C benchmarks#13229
Planeshifter wants to merge 1 commit into
developfrom
philipp/fix-propagation-2026-07-02

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

Propagating fixes merged to develop between fe3bacee0 (2026-07-01 12:58 -0700) and c38afb148 (2026-07-01 13:07 -0700) to sibling packages with the same underlying defect.

Pattern: adopt y != y NaN check and drop unneeded <math.h> in C benchmarks

Source commit fe3bacee0 reworked stats/base/dists/anglit/quantile/benchmark/c/benchmark.c to match sibling style. Among those changes, both if ( isnan( y ) ) sites inside static double benchmark( void ) were switched to the tree's canonical y != y self-comparison idiom, and the now-unneeded #include <math.h> was dropped. The identical pair of defects (unnecessary <math.h> include; isnan( y ) NaN check inconsistent with sibling benchmarks) exists in every listed target, and <math.h> carries no other symbol into any of them. Fix applies verbatim per file: one include line deleted, two isnan( y ) occurrences swapped for y != y.

Related Issues

None.

Questions

No.

Other

Validation

  • Search scope: all lib/node_modules/@stdlib/**/benchmark/c/benchmark.c matching isnan( y ); eight sites returned, all under stats/base/dists/*.
  • Two independent opus validation passes confirmed at every candidate site that (a) #include <math.h> is present on its own line and carries no other symbol into the file (stdlib headers like stdlib/math/base/special/ceil.h are unrelated), (b) exactly two if ( isnan( y ) ) occurrences exist, both inside static double benchmark( void ) — one inside the ITERATIONS loop, one after — and (c) y is declared double and assigned by the loop's first iteration before the check, so y != y is semantically equivalent to isnan( y ) in all reachable states.
  • A sonnet style-consistency pass verified the mechanical patch preserves the include block's contiguous layout and the if ( ... ) single-space padding at both call sites.

Deliberately excluded:

  • The remaining stylistic changes from fe3bacee0 (JSDoc scaffolding for static helpers, /** Main execution sequence. */ before int main, inline // TAP plan / // Use the current time to seed the random number generator: comments, i + 1i+1): every candidate site already carries most of these, and the missing subsets differ per file. Applying them here would drift into "while we're here" cleanup beyond the propagatable core.
  • The two feat: commits from the window (c81fa285 array/filled float16, c38afb148 array/base/getter float16): feature additions, not defect propagations.

Checklist

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 authored by Claude Code on behalf of @Planeshifter as an automated propagation of fixes merged to develop over the prior 24 hours. Candidate source commits were filtered for generalizable patterns, sibling sites located via grep-able pattern signatures, and each proposed patch independently validated by parallel reviewer agents (two opus validation passes plus a sonnet style-consistency pass) before commits were applied in the primary worktree. A human will audit and promote the PR out of draft.


@stdlib-js/reviewers


Generated by Claude Code

Propagates fix from fe3bace ("bench: add missing function documentation
and ensure consistency with other benchmarks") to sibling C benchmarks
still using `isnan( y )`. Removes the now-unneeded `<math.h>` include and
switches both call sites to the tree's canonical `y != y` self-comparison
idiom. Affects: chi/entropy, chisquare/kurtosis, chisquare/mgf,
degenerate/logpmf, degenerate/pdf, degenerate/pmf, degenerate/quantile,
planck/mgf.
@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Jul 2, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/chi/entropy $\\color{green}166/166$
$\\color{green}+100.00\\%$
$\\color{green}8/8$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}166/166$
$\\color{green}+100.00\\%$
stats/base/dists/chisquare/kurtosis $\\color{green}161/161$
$\\color{green}+100.00\\%$
$\\color{green}8/8$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}161/161$
$\\color{green}+100.00\\%$
stats/base/dists/chisquare/mgf $\\color{green}259/259$
$\\color{green}+100.00\\%$
$\\color{green}19/19$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}259/259$
$\\color{green}+100.00\\%$
stats/base/dists/degenerate/logpmf $\\color{green}249/249$
$\\color{green}+100.00\\%$
$\\color{green}19/19$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}249/249$
$\\color{green}+100.00\\%$
stats/base/dists/degenerate/pdf $\\color{green}249/249$
$\\color{green}+100.00\\%$
$\\color{green}19/19$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}249/249$
$\\color{green}+100.00\\%$
stats/base/dists/degenerate/pmf $\\color{green}247/247$
$\\color{green}+100.00\\%$
$\\color{green}19/19$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}247/247$
$\\color{green}+100.00\\%$
stats/base/dists/degenerate/quantile $\\color{green}266/266$
$\\color{green}+100.00\\%$
$\\color{green}18/18$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}266/266$
$\\color{green}+100.00\\%$
stats/base/dists/planck/mgf $\\color{green}252/252$
$\\color{green}+100.00\\%$
$\\color{green}17/17$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}252/252$
$\\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

Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants