Skip to content

fix: correct ellipj declaration signature, parameters, and examples#12458

Merged
kgryte merged 3 commits into
developfrom
philipp/fix-base-special-ellipj-declaration
Jun 3, 2026
Merged

fix: correct ellipj declaration signature, parameters, and examples#12458
kgryte merged 3 commits into
developfrom
philipp/fix-base-special-ellipj-declaration

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

@Planeshifter Planeshifter commented Jun 2, 2026

Description

What is the purpose of this pull request?

This pull request corrects the @stdlib/math/base/special/ellipj TypeScript declaration, which diverged from the implementation (ellipj( u, m )) in several ways:

  • The second parameter m (the modulus) was incorrectly marked optional (x?: number), even though the implementation requires both arguments and provides no default.
  • The @param names and order were swapped relative to the implementation: the declaration named the input value m and the modulus x.
  • The Notes described behavior the implementation does not have, claiming the functions "return NaN for m >= 1" and are "exact for |m| < 2**-24". In fact, the implementation handles all real m via the Abramowitz and Stegun 16.10/16.11 transformations, and only the Jacobi amplitude am is returned as NaN when m < 0 or m > 1.
  • The @returns documents four elements (sn, cn, dn, and am), but every @example showed only three.

This PR aligns the signature, parameter names, Notes, and examples with the implementation JSDoc, and updates the declaration tests for the now-required second argument. See main.js for reference.

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?

Found via a TypeScript-declaration audit of the @stdlib/math namespace. The namespace aggregator (math/base/special/docs/types/index.d.ts) carries the same stale examples; it is generated and will pick up the fix on regeneration.

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.

This issue was identified by an automated TypeScript-declaration audit run with Claude Code, and the fix (including the updated declaration tests) was prepared by Claude Code under my review.


@stdlib-js/reviewers

The `@stdlib/math/base/special/ellipj` TypeScript declaration diverged
from the implementation (`ellipj( u, m )`) in several ways:

- The second parameter `m` (the modulus) was incorrectly marked
  optional (`x?: number`), even though the implementation requires both
  arguments and provides no default.
- The `@param` names and order were swapped relative to the
  implementation: the declaration named the input value `m` and the
  modulus `x`.
- The Notes described behavior the implementation does not have,
  claiming the functions "return `NaN` for `m >= 1`" and are "exact for
  `|m| < 2**-24`". In fact the implementation handles all real `m` via
  the Abramowitz and Stegun 16.10/16.11 transformations, and only the
  Jacobi amplitude `am` is returned as `NaN` when `m < 0` or `m > 1`.
- The `@returns` documents four elements, but every `@example` showed
  only three (omitting `am`).

Align the signature, parameter names, Notes, and examples with the
implementation JSDoc, and update the declaration tests for the now
required second argument.

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: passed
  - task: lint_license_headers
    status: passed
---
@stdlib-bot stdlib-bot added the Math Issue or pull request specific to math functionality. label Jun 2, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

stdlib-bot commented Jun 2, 2026

Coverage Report

Package Statements Branches Functions Lines
math/base/special/ellipj $\color{red}701/713$
$\color{green}+0.00\%$
$\color{red}32/34$
$\color{green}+0.00\%$
$\color{green}7/7$
$\color{green}+0.00\%$
$\color{red}701/713$
$\color{green}+0.00\%$

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

@Planeshifter Planeshifter marked this pull request as ready for review June 3, 2026 00:18
@Planeshifter Planeshifter requested review from a team and kgryte June 3, 2026 00:18
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jun 3, 2026
Signed-off-by: Athan <kgryte@gmail.com>
Comment thread lib/node_modules/@stdlib/math/base/special/ellipj/docs/types/test.ts Outdated
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Copy link
Copy Markdown
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after clean-up.

@kgryte kgryte removed the Needs Review A pull request which needs code review. label Jun 3, 2026
@kgryte kgryte merged commit 6c5aba3 into develop Jun 3, 2026
13 checks passed
@kgryte kgryte deleted the philipp/fix-base-special-ellipj-declaration branch June 3, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Math Issue or pull request specific to math functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants