Skip to content

refactor: use constants/float32/nan in math/base/special/maxf - #16637

Merged
kgryte merged 1 commit into
stdlib-js:developfrom
Mustansir-06:refactor-nan-math-base-special-maxf
Nov 15, 2026
Merged

kgryte merged 1 commit into
stdlib-js:developfrom
Mustansir-06:refactor-nan-math-base-special-maxf

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/maxf/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 examples, 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, and the manifest dependency update.

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

  • This package has three manifest.json configurations and a single inline NaN, so I checked that no other file in the package needed changes.

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_maxf( NaN, 1.0f ) returns NaN and stdlib_base_maxf( 3.0f, 4.0f ) returns 4.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-bot/reviewers

@Mustansir-06
Mustansir-06 requested a review from a team November 15, 2026 08:11
@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 15, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/maxf $\\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.

@kgryte kgryte added difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. C Issue involves or relates to C. review: 5 and removed Needs Review A pull request which needs code review. labels Nov 15, 2026

@kgryte kgryte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@kgryte
kgryte merged commit fdaaa9c into stdlib-js:develop Nov 15, 2026
129 of 130 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C Issue involves or relates to C. difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. Good First PR A pull request resolving a Good First Issue. Math Issue or pull request specific to math functionality. review: 5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants