Closed HashimTheArab closed 2 years ago
Nice find. Signed zero is a thing that floating point numbers have :)
https://en.wikipedia.org/wiki/Signed_zero
It looks like this is arising from the current definition of Round
, which at a glance is doing 'tie breaks round towards nearest', with 'rounding towards zero'.
The if t > 0
is false, so it's rounding as if 'zero is negative'. The sign is appearing from math.Ceil(-0.5)
: https://go.dev/play/p/RtDbZu9JNlF
I think the fix is to change the condition to if t >= 0
because negative zero was neglected. Patches welcome? :)
im not sure how this is even possible lmao