Skip to content

docs: correct s predicate in d.ts Notes for stats/base/dists/cosine/mgf#12101

Open
Planeshifter wants to merge 1 commit into
developfrom
claude/inspiring-curie-5Wcqe
Open

docs: correct s predicate in d.ts Notes for stats/base/dists/cosine/mgf#12101
Planeshifter wants to merge 1 commit into
developfrom
claude/inspiring-curie-5Wcqe

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

@Planeshifter Planeshifter commented May 12, 2026

Description

What is the purpose of this pull request?

This pull request:

  • In stats/base/dists/cosine/mgf, corrects the TypeScript declaration's Notes section from If provided \s < 0`, the function returns `NaN`.toIf provided `s <= 0`, the function returns `NaN`.so it matches the actual validation. The implementation inlib/main.js, lib/factory.js, and src/main.call rejects <= 0.0; the JSDoc declares sasPositiveNumber; and both the README and docs/repl.txtalready documents <= 0`. The d.ts was the lone artifact in the package that disagreed with the source predicate (92.9% conformance across the namespace's d.ts Notes prior to this change, 100% after).

Related Issues

Does this pull request have any related issues?

No related issues.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request?

Detected via a cross-package consistency sweep of the stats/base/dists/cosine namespace (14 packages). The declaration was templated from an eval-function declaration (cdf/pdf/logcdf/logpdf all use s < 0 because they accept s = 0 as a degenerate distribution), but mgf's implementation correctly rejects s = 0 since the raised cosine MGF requires a positive scale; only the d.ts wording was not updated to reflect that.

See:

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 PR was produced end-to-end by Claude Code as part of an automated cross-package API drift detection run scoped to the stats/base/dists/cosine namespace. The drift (d.ts Notes section disagreeing with the source's s <= 0 validation predicate) was identified by majority vote across the 14 sibling packages and confirmed by three independent review passes (semantic, cross-reference, structural) before applying the one-line fix.


@stdlib-js/reviewers


Generated by Claude Code

…e/mgf`

The TypeScript declaration Notes section claimed the function returns
`NaN` when `s < 0`, but the implementation (`lib/main.js`,
`lib/factory.js`, `src/main.c`) rejects `s <= 0.0`, the JSDoc declares
`s` as a `PositiveNumber`, and both the README and `docs/repl.txt`
already document `s <= 0`. The declaration was the only artifact in
the package that disagreed with the actual validation predicate;
update its Notes section to match.

In the wider `stats/base/dists/cosine` namespace, 13 of 14 packages
already have d.ts Notes that match their source validation (7 scalar
moments use `s <= 0`; 4 strictly-evaluated functions use `s < 0`;
quantile mentions both `s` and `p` bounds). `mgf` was the lone
holdout.
@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label May 12, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/cosine/mgf $\color{green}290/290$
$\color{green}+100.00%$
$\color{green}19/19$
$\color{green}+100.00%$
$\color{green}4/4$
$\color{green}+100.00%$
$\color{green}290/290$
$\color{green}+100.00%$

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

@Planeshifter Planeshifter marked this pull request as ready for review May 12, 2026 06:16
@Planeshifter Planeshifter requested review from a team and kgryte May 12, 2026 06:16
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review A pull request which needs code review. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants