Skip to content

Keep unsigned zero positive in JS U32.to_f32 - #1693

Open
oxura wants to merge 1 commit into
bendlang:mainfrom
oxura:fix/js-integer-zero-20261018
Open

oxura wants to merge 1 commit into
bendlang:mainfrom
oxura:fix/js-integer-zero-20261018

Conversation

@oxura

@oxura oxura commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

The C path casts to u32 before converting. Do the same before Math.fround on JS, so a host value of -0 cannot introduce a floating-point sign into an unsigned zero. Integer marshalling and genuine F32 negative-zero inputs stay unchanged.

The regression feeds zero through real typed U32/F32 host answers on both lanes. Before: JS prints 2147483648 for the converted U32, C prints 0. After: both print 0; the F32 negative-zero control still prints 2147483648. Another 4,103 actual exported conversion cases passed, including full-range boundaries. Repository gate: 54/54 with existing caps. No parser, kernel or CHANGELOG edits.

Fixes #1692.

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.

JS U32.to_f32 can give unsigned host zero a negative float sign

1 participant