Calculation returns -0

From the IEEE 754 standard:

Moreover, there are two zero values, called signed zeros: the sign bit specifies whether a zero is +0 (positive zero) or −0 (negative zero).

−0 and +0 compare as equal

Compute sign as Csign = Asign XOR Bsign

If you multiply two floats with differing Sign bit, the standard requires the result to have the Sign bit set to 1, making it negative.

10 Likes