- #1
blalien
- 32
- 0
Homework Statement
You have a number system in base 10 with a precision of 5 digits. Which function is more accurate: x^2-y^2 or (x-y)(x+y)?
Homework Equations
None really.
The Attempt at a Solution
My intuition would tell me that (x-y)(x+y) is more accurate, since multiplication is less accurate than addition or subtraction (unless the two numbers are very close). But look at x = 1.0000, y = 0.00001:
Actual value: 0.999999999
x^2 = 1, y^2 = 1e-10 ~ 0
x^2-y^2=1
x-y = 0.99999
x+y = 1.00001 ~ 1
(x-y)(x+y) = 0.99999
So x^2-y^2 is more accurate, at least in this situation. I have no idea why, though.