$res = 0.0 * -1.0;
I get float -0
What is this strange behavior?
Floating point numbers allow have a signed zero.
You shouldn't worry, however, as +0.0 === -0.0
(demo). (Not that you should use that sort of comparison for floats.)
Because floating-point has both +0 and -0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With