Mentioning C11 just confuses your question because IEEE 754 is not required by any C standard.
However, assuming only 32-bit floating point numbers of IEEE 754 and not making assumptions on x2 and y2 (except for those that are not infinite or NaN), you cannot assume that all bits of the result will be 0. The number of IEEE 754 has two zeros, one negative and one positive, and if the expression (y2 - y0) - (x2 - x0) negative, the result of multiplying it by zero will be a negative zero.
We can verify this with this short example:
#include <stdio.h> #include <stdint.h> int main(int argc, char **argv) { union { float f; uint32_t i; } foo; float a = 0; float b = -1; foo.f = a * b; printf("0x%x\n", foo.i); return 0; }
Result (don't notice the optimization, since I don't want the compiler to be smart):
$ cc -o foo foo.c && ./foo 0x80000000
Oh, I just noticed that the second part of your question, which you called "in other words", is not really other words, because it is a different question.
To start:
(*(uint32_t*)(&a) == *(uint32_t*)(&b))
not equivalent a == b for floating point, because -0 == 0 . And in doing so, the other part of the assumption breaks up because -0 - 0 gives you -0 . I can not do another subtraction of equal numbers, generating a negative zero, but this does not mean that it is impossible, I am sure that the standards do not use the same algorithm for subtraction in all implementations, so the sign bit could sneak there somehow.
source share