In IEEE 754 floating point, it is possible that
a*(b-c) != a*b-a*c // a, b, c double
So expansion of a product is not guaranteed to be equa
IEEE 754 doesn't delve too much into language details. In particular, details like "compile time" aren't specified. That doesn't even make sense for some languages.
The easiest case to understand is when you have an intermediate infinity. Assume that sum(b)==INF
, barely, but a
is 0.5. The result a*sum(b)
is still INF. However, by multiplying first, the subsequent addition no longer overflows.