Instructions
- Read the issue description below.
- Review the example pull request linked below.
- Find one package containing inline NaN generation in a C source file (for example, 0.0/0.0) and update it according to this issue.
- Follow all additional guidance in this issue.
Description
This RFC proposes replacing inline NaN generation in C source files (for example, 0.0/0.0) with the shared stdlib NaN constant from @stdlib/constants/float64/nan.
In short, this RFC seeks to refactor code from this pattern:
to this pattern:
#include "stdlib/constants/float64/nan.h"
...
return STDLIB_CONSTANT_FLOAT64_NAN;
The migration is demonstrated in this PR commit 000785d
In particular, notice three things:
- We add the C header include for the NaN constant.
- We replace inline NaN generation with
STDLIB_CONSTANT_FLOAT64_NAN.
- We add the dependency
@stdlib/constants/float64/nan to manifest configuration entries which compile that same C source file (typically build, benchmark, and examples, when applicable).
By performing this refactoring, we facilitate:
- Consistent NaN handling across packages and targets.
- Better readability and maintainability in C implementations.
Steps
Given the relatively widespread use of inline NaN generation, this RFC is an open call for contributors to do the following:
- Study the example PR commit linked above, as it demonstrates the changes we are seeking.
- Ensure your local development environment is set up by following the contributing guide
- Find one package containing inline NaN generation in C source files.
- Update that package, and only that package, to use
STDLIB_CONSTANT_FLOAT64_NAN from @stdlib/constants/float64/nan.
- Add the include statement for
stdlib/constants/float64/nan.h in updated C sources.
- Update the package manifest dependencies for all task configurations that compile the updated source file.
- Run relevant checks for the package you changed.
- Commit your changes.
- Submit a PR updating that package only.
- Use this PR title template:
refactor: use constants/float64/nan in < package-name >
- In the PR body, use the phrase Resolves a part of , and not Resolves or Closes, because this is a tracking issue.
Related Issues
None.
Questions
None.
Other
- For each pull request, please update only one package.
- Do not make unrelated or stylistic changes. Only replace inline NaN generation with the shared NaN constant and make required dependency updates.
- As this is a Good First Issue, contributors are strongly encouraged to avoid AI for their first contributions and to follow existing project conventions closely.
Checklist
Instructions
Description
This RFC proposes replacing inline NaN generation in C source files (for example, 0.0/0.0) with the shared stdlib NaN constant from
@stdlib/constants/float64/nan.In short, this RFC seeks to refactor code from this pattern:
to this pattern:
The migration is demonstrated in this PR commit 000785d
In particular, notice three things:
STDLIB_CONSTANT_FLOAT64_NAN.@stdlib/constants/float64/nanto manifest configuration entries which compile that same C source file (typically build, benchmark, and examples, when applicable).By performing this refactoring, we facilitate:
Steps
Given the relatively widespread use of inline NaN generation, this RFC is an open call for contributors to do the following:
STDLIB_CONSTANT_FLOAT64_NANfrom@stdlib/constants/float64/nan.stdlib/constants/float64/nan.h inupdated C sources.refactor: use
constants/float64/nanin < package-name >Related Issues
None.
Questions
None.
Other
Checklist