Skip to content

fix: prevent non-terminating searches in stats/base/dists/poisson/quantile - #14734

Merged
kgryte merged 1 commit into
philipp/poisson-quantile-cfrom
philipp/poisson-quantile-edge-cases
Aug 28, 2026
Merged

fix: prevent non-terminating searches in stats/base/dists/poisson/quantile#14734
kgryte merged 1 commit into
philipp/poisson-quantile-cfrom
philipp/poisson-quantile-edge-cases

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • fixes non-terminating quantile searches in @stdlib/stats/base/dists/poisson/quantile (JavaScript and C):
    • a mean parameter lambda equal to +Infinity now returns NaN (mirroring the parameter validation in binomial/quantile)
    • the left/right searches now terminate when unit steps can no longer advance the search position (e.g., beyond 2**53)

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

This PR is stacked on #14731.

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 helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was written primarily by Claude Code; all fixes were verified locally against both the JavaScript and native test suites.


@stdlib-js/reviewers

…antile`

Guards the quantile search against two previously non-terminating
inputs: a mean parameter equal to positive infinity (now returns NaN,
mirroring the parameter validation in `binomial/quantile`) and unit
search steps which no longer advance the search position (e.g., for
search positions exceeding 2^53). Fixes are applied to both the
JavaScript and C implementations.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---
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: passed
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: passed
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: passed
  - 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: na
  - task: lint_license_headers
    status: passed
---
@Planeshifter Planeshifter added the METR Pull request associated with the METR project. label Aug 28, 2026
@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Aug 28, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/poisson/quantile $\\color{red}465/467$
$\\color{green}+99.57\\%$
$\\color{red}56/57$
$\\color{green}+98.25\\%$
$\\color{green}6/6$
$\\color{green}+100.00\\%$
$\\color{red}465/467$
$\\color{green}+99.57\\%$

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

@Planeshifter
Planeshifter marked this pull request as ready for review August 28, 2026 04:28
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 28, 2026
@kgryte
kgryte merged commit de82a86 into philipp/poisson-quantile-c Aug 28, 2026
67 checks passed
@kgryte
kgryte deleted the philipp/poisson-quantile-edge-cases branch August 28, 2026 10:25
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

METR Pull request associated with the METR project. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants