On 9/7/2011 12:51 AM, Steven D'Aprano wrote:
So given a float x, when you square it you get this:Exact values: a*a = a**2 Float values: x*x = (a+e)(a+e) = a**2 + 2*a*e + e**2 So the error term has increased from e to (2*a*e+e**2). It is usual to assume that e**2 is small enough that it underflows to zero, so we have the error term e increasing to 2*a*e as a fairly simple estimate of the new error.
And the relative error, which is what is often important, increases from e/a to 2e/a.
-- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
