Skip to content

fix: preserve sign in math/base/special/{ceil2,floor2} - #15686

Merged
kgryte merged 1 commit into
developfrom
claude/trusting-cannon-k2dafs
Sep 30, 2026
Merged

kgryte merged 1 commit into
developfrom
claude/trusting-cannon-k2dafs

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • propagates fixes merged to develop between 2026-09-29 and 2026-09-30 to sibling packages.
  • propagates 85d7c62 ("fix: preserve sign"), which fixed round2 returning the absolute value of the input when provided the negative smallest subnormal. ceil2 and floor2 share the same early return, in both the JavaScript and C implementations: ceil2( -SMALLEST_SUBNORMAL ) and floor2( -SMALLEST_SUBNORMAL ) currently return +SMALLEST_SUBNORMAL. The JavaScript implementations now return sign * x and the C implementations return x, matching round2. The added tests mirror the one added in 85d7c62.
    • @stdlib/math/base/special/ceil2
    • @stdlib/math/base/special/floor2

Related Issues

Does this pull request have any related issues?

No.

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.

The search covered every lib/main.js and src/main.c under math/base/special/* that has a smallest-subnormal early return. Siblings that were checked and are already correct: round2 (JS), floor2f, round10, ceil10, floor10.

Other source commits in the window had no remaining sites to fix:

  • fb5ec21 (NaN macro parentheses): no other STDLIB_CONSTANT_* macro is an unparenthesized compound expression.
  • ec5c016 (enum doc example, benchmark values): the sibling ml/base/sgd enums and resolve benchmarks are already correct.
  • d374b24 (strictEqual( ( a === b ), true )): no remaining occurrences.

Validation: an independent review read each file in full and confirmed each site. The JS tests were run before and after the fix. Native builds were not available, so the C changes were not compiled or run.

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 fix-propagation routine.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01TurpzeynpkmbhtrFiaufhM


Generated by Claude Code

Propagates fix from 85d7c62 ("fix: preserve sign") to sibling packages which return the absolute value of the input when provided the negative smallest subnormal.

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/ceil2 $\\color{green}193/193$
$\\color{green}+100.00\\%$
$\\color{green}19/19$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}193/193$
$\\color{green}+100.00\\%$
math/base/special/floor2 $\\color{green}193/193$
$\\color{green}+100.00\\%$
$\\color{green}19/19$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}193/193$
$\\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 September 30, 2026 19:13
@kgryte
kgryte requested a review from a team September 30, 2026 19:13
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 30, 2026
@kgryte
kgryte merged commit 7271dd6 into develop Sep 30, 2026
50 checks passed
@kgryte
kgryte deleted the claude/trusting-cannon-k2dafs branch September 30, 2026 19:15
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 30, 2026
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants