Why it is more accurate to evaluate $x^2-y^2$ as $(x+y)(x-y)$ in floating point system? The expression $x^2-y^2$ exhibits catastrophic cancellation if $|x|\approx|y|$. 
Why it is more accurate to evaluate as $(x+y)(x-y)$ in floating point system (like IEEE 754)? I see this is intuitively true. Any one can help demonstrate an example when $|x|\approx|y|$? And is there any (or how to write) a formal proof for the claim? 
A detailed explanation would be very much appreciated! Thank you!

I guess the answer is when $x$ and $y$ are large, $x^2$ and $y^2$ are larger. If they are of the same order of magnitude then when you consider evaluating $x^2 - y^2$ you are taking away two large numbers and the round off error will be larger than if you write it is $(x + y) (x - y)$. For $x \approx y$, the second approach gives $\approx 2x \times (x-y)$. Hope that helps.
