Reputation: 470
$res = 0.0 * -1.0;
I get float -0
What is this strange behavior?
Upvotes: 6
Views: 145
Reputation: 50858
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.)
Upvotes: 8