I did some testing and unfortunately could not get them to produce different results with bitwise operators.
I have been looking at the spec for how it decides what to do and it seems that unless explicitly stated otherwise, -0 and 0 are treated the same.
-0
0
That’s unfortunate.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I did some testing and unfortunately could not get them to produce different results with bitwise operators.
I have been looking at the spec for how it decides what to do and it seems that unless explicitly stated otherwise,
-0
and0
are treated the same.That’s unfortunate.