Terry Reedy <tjre...@udel.edu> writes:

> On 11/27/2010 5:55 PM, kj wrote:
>
>> Therefore, to implement this multiplication operation I need to
>> have a way to verify that the float tuples C and D are "equal".
>
> I might try the average relative difference:
> sum(abs((i-j)/(i+j)) for i,j in zip(C,D))/n # assuming lengths constant

That'll throw an exception if i == -j.  You could replace (i+j) with
math.hypot(i, j) or abs(i)+abs(j) but it will still fail when i == j ==
0.

-- 
Arnaud

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to