Skip to content

fix(base): preserve negative zero in F32.round - #1613

Merged
Lorenzobattistela merged 1 commit into
bendlang:mainfrom
oxura:fix/f32-round-signed-zero-20261016
Oct 16, 2026
Merged

Lorenzobattistela merged 1 commit into
bendlang:mainfrom
oxura:fix/f32-round-signed-zero-20261016

Conversation

@oxura

@oxura oxura commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #1611.

When rounding produces zero, this restores the input sign instead of returning the positive zero created by the final addition. Other results and the existing ties-toward-positive-infinity rule stay unchanged.

The regression covers -0, a negative fraction through its reciprocal, the negative half, and the adjacent value that must still round to -1. Before: 0, False, 0, True. After: 2147483648, True, 2147483648, True on both Bun and native C. The existing number kit also passes on both.

Linux x86-64, Bun 1.4.3, clang 22.1.8. Current main has an unrelated compiler token-cap failure; this changes only Base and its regression, not the compiler or caps. The mini-cluster/Metal/CUDA gates were not run here. AI-assisted patch.

@Lorenzobattistela Lorenzobattistela self-assigned this Oct 16, 2026
@Lorenzobattistela
Lorenzobattistela merged commit 22d627b into bendlang:main Oct 16, 2026
1 of 2 checks passed
@Lorenzobattistela Lorenzobattistela mentioned this pull request Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F32.round loses the sign of negative zero

2 participants