fix: correct ellipj declaration signature, parameters, and examples#12458
Merged
Conversation
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
---
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
Signed-off-by: Athan <kgryte@gmail.com>
kgryte
reviewed
Jun 3, 2026
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
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 corrects the
@stdlib/math/base/special/ellipjTypeScript declaration, which diverged from the implementation (ellipj( u, m )) in several ways:m(the modulus) was incorrectly marked optional (x?: number), even though the implementation requires both arguments and provides no default.@paramnames and order were swapped relative to the implementation: the declaration named the input valuemand the modulusx.NaNform >= 1" and are "exact for|m| < 2**-24". In fact, the implementation handles all realmvia the Abramowitz and Stegun 16.10/16.11 transformations, and only the Jacobi amplitudeamis returned asNaNwhenm < 0orm > 1.@returnsdocuments four elements (sn, cn, dn, andam), but every@exampleshowed 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
No.
Questions
No.
Other
Found via a TypeScript-declaration audit of the
@stdlib/mathnamespace. 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
AI Assistance
If you answered "yes" above, how did you use AI assistance?
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