Skip to content

bench: use isnanf in strided/napi/smap#13385

Merged
kgryte merged 1 commit into
developfrom
philipp/drift-strided-napi-2026-07-09
Jul 9, 2026
Merged

bench: use isnanf in strided/napi/smap#13385
kgryte merged 1 commit into
developfrom
philipp/drift-strided-napi-2026-07-09

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

Normalizes the NaN guard in @stdlib/strided/napi/smap's native benchmark to match the rest of the single-precision NAPI family.

strided/napi/smap

smap operates exclusively on Float32Array (declared at benchmark/benchmark.native.js:26,49-50), but its NaN guard imports @stdlib/math/base/assert/is-nan — the double-precision helper. Its four single-precision sibling packages in @stdlib/strided/napi/ (smap2, smskmap, smskmap2, cmap) all use @stdlib/math/base/assert/is-nanf in the same benchmark position; smap is the sole outlier (4/5 → 80% conformance within the single-precision family). Swap the require and the two call sites to align with the family.

Related Issues

No.

Questions

No.

Other

Detected by a cross-package drift audit over the 15 members of @stdlib/strided/napi. The single-precision-family NaN-helper feature has a clear majority (isnanf in 4/5 float32-precision packages, i.e. smap2/smskmap/smskmap2/cmap); smap deviates and its deviation is not justified by any semantic difference from smap2. The remainder of the namespace was clean once intentional generic-vs-specialized and unary-vs-binary-vs-nullary splits were accounted for. One sub-threshold observation surfaced (; missing from the STDLIB_STRIDED_NAPI_MODULE_<NAME>(...) code-fence line in 4 of 14 README / header @example blocks — cmap/dmap/smap/zmap) but sits at 10/14 = 71% conformance, below the 75% majority bar; not proposed here.

Checklist

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

This PR was authored by Claude Code running the cross-package drift-detection routine on the @stdlib/strided/napi namespace. Structural features were extracted with a script, semantic drift was surfaced by three parallel subagents auditing READMEs, C sources, and JS/TS files, and the sole surviving correction was adversarially verified by a second agent before being applied. A human maintainer will audit before promoting out of draft.


@stdlib-js/reviewers


Generated by Claude Code

The `smap` package operates on `Float32Array` values but its native
benchmark still guarded against NaN via the double-precision `isnan`
helper. All four sibling single-precision NAPI packages
(`strided/napi/smap2`, `strided/napi/smskmap`, `strided/napi/smskmap2`,
and `strided/napi/cmap`) use `@stdlib/math/base/assert/is-nanf`
in the same position (4/5 of the single-precision family). Swap the
import and the two call sites to bring `smap` in line with its family.
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
strided/napi/smap $\\color{green}162/162$
$\\color{green}+100.00\\%$
$\\color{green}5/5$
$\\color{green}+100.00\\%$
$\\color{green}1/1$
$\\color{green}+100.00\\%$
$\\color{green}162/162$
$\\color{green}+100.00\\%$

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

@kgryte kgryte marked this pull request as ready for review July 9, 2026 06:22
@kgryte kgryte requested a review from a team July 9, 2026 06:22
@kgryte kgryte merged commit 49456e6 into develop Jul 9, 2026
20 checks passed
@kgryte kgryte deleted the philipp/drift-strided-napi-2026-07-09 branch July 9, 2026 06:23
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jul 9, 2026
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants