Why is (1-x)(1+x) preferred to (1-x^2)?

Viewed 2145

I was looking at a runtime library implementation of arcsin which was implemented by calculating:

ArcTan(X, Sqrt(1 - X*X))

However, the code that calculated 1 - X*X actually evaluated (1-X)*(1+X). Is there a good reason for preferring the latter? I suspect that the latter reduces round-off inaccuracy for X close to zero, but I cannot reason why that would be so.

2 Answers
Related