Skip to content

refactor: use constants/float32/nan in stats/strided/snanmeanpn#11769

Open
manit2004 wants to merge 2 commits intostdlib-js:developfrom
manit2004:refactor-snanmeanpn-nan
Open

refactor: use constants/float32/nan in stats/strided/snanmeanpn#11769
manit2004 wants to merge 2 commits intostdlib-js:developfrom
manit2004:refactor-snanmeanpn-nan

Conversation

@manit2004
Copy link
Copy Markdown
Contributor

@manit2004 manit2004 commented Apr 25, 2026

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 status: passed
  • 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: missing_dependencies
  • task: lint_c_examples status: missing_dependencies
  • task: lint_c_benchmarks status: missing_dependencies
  • 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 ---

Resolves #11743 .

Description

What is the purpose of this pull request?

This pull request:

  • Replace inline 0.0f/0.0f Float32 NaN generation with STDLIB_CONSTANT_FLOAT32_NAN macro from constants/float32/nan

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

  • No

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.

No.

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.".


@stdlib-js/reviewers

@manit2004 manit2004 requested a review from a team April 25, 2026 07:01
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. labels Apr 25, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

Hello! Thank you for your contribution to stdlib.

We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:

  1. Please read our contributing guidelines.

  2. Update your pull request description to include this checked box:

    - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)

This acknowledgment confirms that you've read the guidelines, which include:

  • The developer's certificate of origin
  • Your agreement to license your contributions under the project's terms

We can't review or accept contributions without this acknowledgment.

Thank you for your understanding and cooperation. We look forward to reviewing your contribution!

@stdlib-bot
Copy link
Copy Markdown
Contributor

stdlib-bot commented Apr 25, 2026

Coverage Report

Package Statements Branches Functions Lines
stats/strided/snanmeanpn $\color{green}404/404$
$\color{green}+0.00%$
$\color{green}26/26$
$\color{green}+0.00%$
$\color{green}4/4$
$\color{green}+0.00%$
$\color{green}404/404$
$\color{green}+0.00%$

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

@manit2004
Copy link
Copy Markdown
Contributor Author

@anandkaranubc Please take a look.

@stdlib-bot stdlib-bot added the Potential Duplicate There might be another pull request resolving the same issue. label Apr 26, 2026

```c
const float x[] = { 1.0f, -2.0f, 0.0f/0.0f, 2.0f };
const double x[] = { 1.0f, -2.0f, STDLIB_CONSTANT_FLOAT32_NAN, 2.0f };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why double?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing that out. I only intended to replace inline NaN literals in this PR, and I got mixed up by the nearby double v line in the existing snippet.


```c
const float x[] = { 1.0f, -2.0f, 0.0f/0.0f, 2.0f };
const double x[] = { 1.0f, -2.0f, STDLIB_CONSTANT_FLOAT32_NAN, 2.0f };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same comment..

…LIB_CONSTANT_FLOAT32_NAN from stdlib/constants/float32/nan

---
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
    status: passed
  - 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: missing_dependencies
  - task: lint_c_examples
    status: missing_dependencies
  - task: lint_c_benchmarks
    status: missing_dependencies
  - 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
---
@github-actions github-actions Bot mentioned this pull request Apr 26, 2026
@manit2004 manit2004 force-pushed the refactor-snanmeanpn-nan branch 2 times, most recently from 9d1ada6 to 375991b Compare April 26, 2026 13:01
Signed-off-by: Manit Roy <manit.roy@research.iiit.ac.in>
@manit2004 manit2004 requested a review from anandkaranubc April 26, 2026 13:09
@manit2004
Copy link
Copy Markdown
Contributor Author

@anandkaranubc I have cleaned up the mistakes you have pointed out, please check.

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. Potential Duplicate There might be another pull request resolving the same issue. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: Replace inline NaN literals with stdlib NaN macro across float32 and float64 packages

3 participants