On 29 nov, 00:20, Nobody wrote:
> On Sat, 27 Nov 2010 18:23:48 -0500, Terry Reedy 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
On Sat, 27 Nov 2010 18:23:48 -0500, Terry Reedy 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 le
kj wrote:
> I understand that, in Python 2.7 and 3.x >= 3.1, when the interactive
> shell displays a float it shows "the shortest decimal fraction that
> rounds correctly back to the true binary value". Is there a way
> to access this rounding functionality from code that must be able
> to run un
On Sat, 27 Nov 2010 22:55:10 +, 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".
That C and D are tuples of floats is irrelevant. The problem boils down
to testing floats for equality.
It's e
Terry Reedy 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
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
Certainly, I w
I'm defining a class (Spam) of objects that are characterized by
three parameters, A, B, C, where A and C are n-tuples of floats
and B is an n*n tuple-of-tuples of floats. I'm defining a limited
multiplication for these objects, like this:
Spam(A, B, C) * Spam(D, E, F) = Spam(A, dot(B, E), F)