Skip to content

refactor: use constants/float32/nan in math/base/special/minf - #16673

Open
Mustansir-06 wants to merge 1 commit into
stdlib-js:developfrom
Mustansir-06:refactor-nan-math-base-special-minf
Open

Mustansir-06 wants to merge 1 commit into
stdlib-js:developfrom
Mustansir-06:refactor-nan-math-base-special-minf

Conversation

@Mustansir-06

Copy link
Copy Markdown
Contributor

Resolves a part of #11743.

Description

What is the purpose of this pull request?

This pull request:

  • replaces inline NaN generation (0.0f / 0.0f) in math/base/special/minf/src/main.c with the stdlib NaN constant STDLIB_CONSTANT_FLOAT32_NAN from @stdlib/constants/float32/nan.
  • adds #include "stdlib/constants/float32/nan.h" alongside the existing stdlib includes in src/main.c.
  • adds @stdlib/constants/float32/nan as a dependency in the build, benchmark and examples configurations in manifest.json.

No inline NaN generation remained in this package's C example, C benchmark or README, so only src/main.c and manifest.json changed.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Reference Packages

Did the content of this pull request follow one or more existing packages? Answering is optional.

This pull request followed these packages:

What carried over from the reference(s)?

  • The same replacement of the inline NaN with the NaN macro, the include placement next to the other stdlib constants include, and the manifest dependency update in every configuration that compiles src/main.c.

What differed, or what did you have to work out yourself?

  • Nothing significant. This package mirrors maxf (with ninf and the negative-zero check in place of pinf and the positive-zero check), so the same two-file change applied.

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.

I'm on Windows and could not run the project's make build and lint locally. To check that behavior is unchanged, I compiled src/main.c with gcc together with its dependencies, before and after the change, and confirmed that stdlib_base_minf( NaN, 1.0f ) returns NaN and stdlib_base_minf( 3.0f, 4.0f ) returns 3.0f in both cases. I'm relying on CI for the rest.

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

N/A

@stdlib-js/reviewers

@Mustansir-06
Mustansir-06 requested a review from a team November 17, 2026 12:08
@stdlib-bot stdlib-bot added Math Issue or pull request specific to math functionality. Needs Review A pull request which needs code review. Good First PR A pull request resolving a Good First Issue. labels Nov 17, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/minf $\\color{green}176/176$
$\\color{green}+100.00\\%$
$\\color{green}16/16$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}176/176$
$\\color{green}+100.00\\%$

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Math Issue or pull request specific to math functionality. Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants