[Python-Dev] sum()

Tim Peters tim.peters at gmail.com
Sat Mar 12 05:23:43 CET 2005


[Tim Peters]
...
> One clever way is to build on that whenever |x| and |y| are within a
> factor of 2 of each other, x+y is exact in 754 arithmetic.

Ack, I'm fried.  Forget that, it's wrong.  The correct statement is
that x-y is always exact whenever x and y are within a factor of two
of each other.  Summer.add() _can_ lose info -- it needs additional
trickery to make it loss-free, and because x+y can lose (at most one
bit) when x and y have the same binary exponent.

Exercise for the abused reader <wink>.


More information about the Python-Dev mailing list