Skip to content

style: format if conditions in stats/base/dists/rayleigh#12889

Draft
Planeshifter wants to merge 2 commits into
developfrom
philipp/drift-stats-base-dists-rayleigh-2026-06-14
Draft

style: format if conditions in stats/base/dists/rayleigh#12889
Planeshifter wants to merge 2 commits into
developfrom
philipp/drift-stats-base-dists-rayleigh-2026-06-14

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

This pull request aligns two C source files in @stdlib/stats/base/dists/rayleigh with the formatting and floating-point-literal conventions used across the rest of the namespace.

Namespace summary

  • Members analyzed: 15 (cdf, ctor, entropy, kurtosis, logcdf, logpdf, mean, median, mgf, mode, pdf, quantile, skewness, stdev, variance).
  • C-binding members: 14 (all except ctor, which is a JS-only constructor).
  • Features with a clear majority (≥75%): C-source if predicate format (12/14, 85.7%), floating-point-literal use in sigma < 0.0 comparisons (13/14, 92.8%), lib/main.js validation predicate (sigma < 0.0, 7/8 sigma-only packages), @param {NonNegativeNumber} sigma JSDoc type (7/8), package.json top-level shape, README.md section order, lib/native.js / manifest.json / binding.gyp presence, examples/c/example.c shape, docs/types/index.d.ts shape.
  • Features without a clear majority (excluded): README ## Notes section presence (2/6 in factory packages), 0.0/0.0 vs 0.0 / 0.0 whitespace in NaN literals (8 vs 6, no majority).

Outlier packages

stats/base/dists/rayleigh/median

Reformats the if predicate in src/main.c to the multi-line form used across 12 of 14 sibling distributions and replaces the integer literal 0 with 0.0 to match the floating-point convention established in #12204. Both deviations were introduced when median was added in 2025 and went undetected. Brings the file into conformance with the rest of the package.

stats/base/dists/rayleigh/variance

Reformats the if predicate in src/main.c to the multi-line form used by 12 of 14 sibling distributions in the namespace. The single-line guard was the only divergence from the established pattern; no behavioral change.

Related Issues

None.

Questions

None.

Other

Validation

  • Structural features (file tree, package.json shape, README sections, manifest shape) were extracted across all 15 members and compared against a 75% majority threshold.
  • Semantic features (validation predicates, error construction, JSDoc shape, public signatures) were extracted from lib/main.js, lib/index.js, and any lib/factory.js in each package.
  • Each candidate correction was reviewed by three independent agents (semantic-review, cross-reference, structural-review). All three returned confirmed-drift for the items in this PR.
  • Deliberately excluded:
    • entropy/lib/main.js uses sigma <= 0.0 and @param {PositiveNumber} rather than the sibling pattern sigma < 0.0 / @param {NonNegativeNumber}. The C source and JS tests are internally consistent; aligning would change observable behavior at sigma === 0, which is out of scope for a drift-correction PR.
    • mgf/lib/factory.js lacks the sigma === 0.0degenerate short-circuit present in the other five factory packages. Applying it would change mgf(t, 0) from SQRT_HALF_PI to 1.0. Worth a separate bug-fix PR, but out of scope here.
    • mgf lacks test/fixtures/julia/; the closed-form MGF formula does not need empirical comparison fixtures, so absence is intentional.
    • ctor lacks C-binding artifacts entirely (intentional — it is a JS-only constructor).

Disclosure

This pull request was produced by an automated cross-package drift-detection routine running under Claude Code. The agent extracted structural and semantic features across all members of the namespace, computed per-feature majorities, validated each candidate correction with three independent reviewer agents, and applied only those corrections that did not change observable behavior. All changes were reviewed before commit.

Checklist

AI Assistance

  • Yes

  • No

  • 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 end-to-end by an automated drift-detection routine running under Claude Code: feature extraction, three-agent validation, code changes, commit composition, and PR body. A maintainer should review before merging.



Generated by Claude Code

claude added 2 commits June 14, 2026 20:13
Reformat the `if` predicate in `src/main.c` to the multi-line style
used by the majority of sibling C sources in
`@stdlib/stats/base/dists/rayleigh` (12 of 14 packages, 85.7%
conformance), and replace the integer literal `0` with the
floating-point literal `0.0` (13 of 14 packages, 92.8% conformance)
to match the convention established by #12204. No behavior change.
Reformat the `if` predicate in `src/main.c` to the multi-line style
used by the majority of sibling C sources in
`@stdlib/stats/base/dists/rayleigh` (12 of 14 packages, 85.7%
conformance). No behavior change.
@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Jun 14, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/rayleigh/median $\\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/rayleigh/variance $\\color{green}162/162$
$\\color{green}+100.00\\%$
$\\color{green}8/8$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}162/162$
$\\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