Tim Peters <t...@python.org> added the comment:

Sure, if we make more assumptions.  For 754 doubles, e.g., scaling isn't needed 
if `1e-100 < absmax < 1e100` unless there are a truly ludicrous number of 
points.  Because, if that holds, the true sum is between 1e-200 and 
number_of_points*1e200, both far from being near trouble.

Then the summation loop gets mostly duplicated (with and without scaling), a 
platform-dependent assumption is introduced, and we need two test-and-branches 
to determine which to run.  In the common two-argument cases, it saves one 
division in return.

Note that without the current form of scaling, we lose the guarantee that the 
sum is exact when all the arguments are the same (because they're all scaled to 
exactly 1.0 then, but in general each x*x loses half the product bits without 
scaling).  I don't care about that myself, but Serhiy seems to.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34376>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to