The question description itself is pretty simple, let's say i have two variable, the big and scale, all i want to do is calculating:
float res = big * scale * scale;
As you can see, there exists two arithmetic order:
// #1
float res = (big * scale) * scale;
// #2
float res = big * (scale * scale);
Due to the fact of IEEE754 single precision standard, it is natural that the above two line will give different result.
Now i have some priori knowledge that big might vary from 0 to ~1000, scale might vary from 0 to 2^-10. The big is not that "big" that might "eat the small". And the scale is not that "small" to cause underflow when multiply themselves. That leaves my question is, which arithmetic order should i adopt to get a "smaller error", compared with the "real" value?