Skip to content

Ensure unary Float32#- and Float64#- flip sign bit#15857

Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom
HertzDevil:bug/float-primitive-neg
Jun 1, 2025
Merged

Ensure unary Float32#- and Float64#- flip sign bit#15857
straight-shoota merged 1 commit intocrystal-lang:masterfrom
HertzDevil:bug/float-primitive-neg

Conversation

@HertzDevil
Copy link
Contributor

-0.0 is a number literal representing the negative signed zero, whereas -(0.0) is the call #-() on the literal 0.0. The latter is implemented as 0.0 - self and returns positive zero, but this is incorrect. This PR fixes the discrepancy.

@HertzDevil HertzDevil added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:numeric labels May 30, 2025
@straight-shoota straight-shoota added this to the 1.17.0 milestone May 30, 2025
@straight-shoota straight-shoota merged commit 4a073fa into crystal-lang:master Jun 1, 2025
38 checks passed
@HertzDevil HertzDevil deleted the bug/float-primitive-neg branch June 1, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:numeric

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants