refactor: use floating-point zero literals in stats/base/dists/rayleigh#12204
Merged
kgryte merged 2 commits intoMay 19, 2026
Merged
Conversation
…igh/variance` Normalize the `sigma` scale-parameter guard to compare against an explicit floating-point zero (`sigma < 0.0`) rather than a bare integer literal (`sigma < 0`). The explicit form is used by 12 of the 14 numeric-function packages in the `rayleigh` namespace (86%) and by ~94% of `main.js` guards across `@stdlib/stats/base/dists`. The change is behavior-preserving.
…igh/stdev` Normalize the `sigma` scale-parameter guard to compare against an explicit floating-point zero (`sigma < 0.0`) rather than a bare integer literal (`sigma < 0`). The explicit form is used by 12 of the 14 numeric-function packages in the `rayleigh` namespace (86%) and by ~94% of `main.js` guards across `@stdlib/stats/base/dists`. The change is behavior-preserving.
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request normalizes the
sigmascale-parameter validation guard in two@stdlib/stats/base/dists/rayleighpackages to compare the scale parameter against0.0(an explicit floating-point zero literal) rather than0(a bare integer literal). The explicit floating-point form is used by 12 of the 14 numeric-function packages in the namespace (86%) and is the sole form used elsewhere in@stdlib/stats/base/dists:varianceandstdevwere the only twolib/main.jsparameter guards in the entire distribution namespace using a bare integer literal (~94% ecosystem conformance). The change is behavior-preserving, since0and0.0denote the same IEEE 754 value.stats/base/dists/rayleigh/variancevariance/lib/main.jsguarded thesigmascale parameter against a bare integer0. The parameter is a float64NonNegativeNumber, and the function body already uses floating-point literals throughout (4.0,2.0); the bare integer was incidental. The guard now compares against0.0.stats/base/dists/rayleigh/stdevstdev/lib/main.jscarried the same bare-integer guard. It now compares against0.0, consistent with sibling packages includingmean,median, andkurtosis.Related Issues
No.
Questions
No.
Other
The change touches only the JavaScript validation guard in each package; tests, examples, REPL fixtures, and TypeScript declarations are unaffected, and the native (C) implementations were not modified.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was produced by Claude Code running an automated cross-package consistency check. The routine extracted structural and semantic features from every package in the
rayleighnamespace, identified the explicit floating-point parameter-guard literal as the majority convention, flaggedvarianceandstdevas the outliers, and applied the two-line normalization. The change was independently reviewed for behavior preservation and for the absence of any dependent tests or documentation.@stdlib-js/reviewers