Skip to content

bench: add native C benchmark to math/base/special/cfloor - #16331

Draft
Planeshifter wants to merge 2 commits into
developfrom
claude/cool-johnson-9aqdrl
Draft

Planeshifter wants to merge 2 commits into
developfrom
claude/cool-johnson-9aqdrl

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • adds the missing native C benchmark to math/base/special/cfloor. Every other package in math/base/special that ships a C implementation already has one.

math/base/special/cfloor

  • Adds benchmark/c/native/Makefile and benchmark/c/native/benchmark.c. 383 of 384 packages in the namespace (99.7%) have these files, including cceil, cceilf, cfloorf, and cfloorn.
  • cfloor already provides src/main.c, lib/native.js, benchmark/benchmark.native.js, and a benchmark task in manifest.json. Its only C benchmark was benchmark/c/benchmark.c, which times libm floor rather than stdlib_base_cfloor.
  • The new benchmark mirrors cceil/benchmark/c/native/benchmark.c, with the package name and C function swapped. The Makefile matches cceil and cround apart from the copyright year.

Related Issues

Does this pull request have any related issues?

None.

Reference Packages

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

This pull request followed these packages:

  • math/base/special/cceil

What carried over from the reference(s)?

  • The benchmark layout, the Makefile, the TAP output, and the random input generation.

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

  • Only the header include, the NAME, and the function under test (stdlib_base_cfloor).

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.

How the drift was found. We extracted structural features (file tree, package.json keys, README section order, manifest.json keys) and semantic features (JSDoc shape, error construction, validation prologue) from all 384 packages in math/base/special. Any feature with at least 75% agreement counted as the majority pattern.

  • Every semantic feature in the namespace is uniform. These are pure numeric functions with no validation and no thrown errors, so there was no semantic drift to fix.
  • We excluded deviations that reflect real differences between packages:
    • maxn, minn, maxabsn, minabsn, minmaxn, minmaxabsn, and sici have no C implementation at all. Adding one is not a mechanical fix.
    • The kernel-cos, kernel-sin, kernel-tan, and rempio2 READMEs have an extra ### Notes section under ## C APIs. This adds content and doesn't break the pattern.
    • fast is a nested namespace, not a package.
  • Native benchmarks also exist outside this namespace: 1639 of 1729 stdlib packages with src/main.c (94.8%) ship a C benchmark.
  • Validation: an independent review checked that the native benchmark applies to cfloor and that no tests, examples, or docs depend on its absence. Open PR feat: add assign and strided methods to math/base/special/cfloor #16025 also touches cfloor, but it does not add benchmark/c/native, so the two don't overlap.
  • The benchmark was compiled with gcc -std=c99 -O3 against the package sources and run successfully: 1e6 iterations, TAP ok.

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

This PR was written primarily by Claude Code, as part of an automated check for drift between packages in a namespace.



Generated by Claude Code

Added missing `benchmark/c/native/Makefile` and `benchmark/c/native/benchmark.c` (present in 383/384, 99.7%, of `math/base/special` packages, including `cceil`, `cceilf`, `cfloorf`, and `cfloorn`). Content mirrors `math/base/special/cceil` with the package name and C function substituted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wWD77jkABgfoQzdCbeSyY
@stdlib-bot stdlib-bot added the Math Issue or pull request specific to math functionality. label Oct 27, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/cfloor $\\color{green}180/180$
$\\color{green}+100.00\\%$
$\\color{green}5/5$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}180/180$
$\\color{green}+100.00\\%$

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

Port of #16328. CI `npm install` currently fails building `@kaciras/deasync` (`binding.gyp not found`), breaking `Lint PR title` and other install-dependent jobs. This change no-ops once the base branch carries the same pin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wWD77jkABgfoQzdCbeSyY

Copy link
Copy Markdown
Member Author

Lint PR title failed during npm install, before the title check ran. The @kaciras/deasync install step fails with binding.gyp not found. This PR didn't cause it: every recent lint_pr_title run on develop-based PRs fails the same way, and the diff here touches no dependencies.

I ported the fix from #16328 (pin @kaciras/deasync to 1.0.4) in e5a2aeb. It becomes a no-op once #16328 lands on develop.


Generated by Claude Code

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​kaciras/​deasync@​1.2.0 ⏵ 1.0.484 -110090 -980 -6100

View full report

@stdlib-bot stdlib-bot added the Merge Conflicts Pull request which has merge conflicts. label Oct 28, 2026

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

Math Issue or pull request specific to math functionality. Merge Conflicts Pull request which has merge conflicts.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants