Skip to content

feat: add stats/incr/nanminabs#12246

Open
faisalaffan wants to merge 1 commit into
stdlib-js:developfrom
faisalaffan:feat/add-stats-incr-nanminabs
Open

feat: add stats/incr/nanminabs#12246
faisalaffan wants to merge 1 commit into
stdlib-js:developfrom
faisalaffan:feat/add-stats-incr-nanminabs

Conversation

@faisalaffan
Copy link
Copy Markdown

Resolves #5552.

Description

What is the purpose of this pull request?

This pull request:

  • Adds @stdlib/stats/incr/nanminabs — an incremental accumulator for the minimum absolute value that ignores NaN inputs instead of propagating them.

The implementation is a thin wrapper around @stdlib/stats/incr/nanminabs, following the same pattern as @stdlib/stats/incr/nansum. When the accumulator receives a NaN, it skips it and returns the current minimum unchanged. If all inputs so far have been NaN, the accumulator returns null (consistent with the empty-state behavior of nanminabs).

The signed-zero behavior follows the same convention as nanminabs where -0 and +0 are treated as equal.

This is a revised version of #5637, which has been left open with review feedback unaddressed on the package name, description wording, and format string. All three issues have been addressed in this PR.

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?

One minor thing: in the REPL docs I used "minimum absolute value" as the short description — same as nanminabs. Let me know if a different phrasing is preferred since the NaN-handling changes the semantics slightly.

Other

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

make test TESTS_FILTER=".*/stats/incr/nanminabs/.*"
# 10/10 pass

make examples EXAMPLES_FILTER=".*/stats/incr/nanminabs/.*"
# runs successfully

make benchmark BENCHMARKS_FILTER=".*/stats/incr/nanminabs/.*"
# 6/6 pass

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

@stdlib-js/reviewers

---
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: na
  - task: lint_license_headers
    status: passed
---
@faisalaffan faisalaffan requested a review from a team May 22, 2026 18:32
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Good First PR A pull request resolving a Good First Issue. labels May 22, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

👋 Hi there! 👋

And thank you for opening your first pull request! We will review it shortly. 🏃 💨

Getting Started

Next Steps

  1. A project maintainer will approve GitHub Actions workflows for your PR.
  2. All CI checks must pass before your submission can be fully reviewed.
  3. You'll need to address any failures in linting or unit tests.

Running Tests Locally

You can use make to run any of the CI commands locally from the root directory of the stdlib repository:

# Run tests for all packages in the math namespace:
make test TESTS_FILTER=".*/@stdlib/math/.*"

# Run benchmarks for a specific package:
make benchmark BENCHMARKS_FILTER=".*/@stdlib/math/base/special/sin/.*"

If you haven't heard back from us within two weeks, please ping us by tagging the "reviewers" team in a comment on this PR.

If you have any further questions while waiting for a response, please join our Zulip community to chat with project maintainers and other community members.

We appreciate your contribution!

Documentation Links

@faisalaffan faisalaffan marked this pull request as draft May 22, 2026 18:36
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label May 22, 2026
@faisalaffan faisalaffan marked this pull request as ready for review May 22, 2026 18:42
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Good First PR A pull request resolving a Good First Issue. 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.

[RFC]: add stats/incr/nanminabs

2 participants