I am working with python and playing with multiplications and divisions but I can't get the accuracy that I want with this operations. The following example may help to reach my point.
Let a = 3
and b = 4
, their euclidean norm (sqrt(a*a + b*b))
is 5.0, and divisions work fine, like 3/5.0
which is 0.6, and 4/5.0
= 0.8. But when I want to make the following 3 * -0.8 + 0.6*4
the answer is a little number but not the expected zero.
I know the problems inherent to data type, registers and in general the machine limits, but I think there must be a way that for at least simple computations (like the example) are made with no errors.