This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients Jeffrey.Kintscher, mark.dickinson, pablogsal, rhettinger, tim.peters, veky
Date 2020-08-06.23:02:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1596754964.27.0.869376635422.issue41458@roundup.psfhosted.org>
In-reply-to
Content
The algorithm stops all spurious overflows and underflows.  If favorable cancellations exist, it finds them.

Algorithm in Words
------------------

For every x in the sequence, multiply onto the total if possible.

If x and "total" can't be combined without overflow/underflow, then x is given a "side" depending on |x| > 1.0.  This indicates whether multiplying by x would increase the magnitude or decrease it.

Note that "total" has the same side as "x". If one would increased magnitude and the other would decreased it, then our "total *= x" would have succeeded.

The list "s" has the other pending multiplies.  Each of them are on the same side — either they all increase the magnitude or they all decrease it.  The direction is stored in the "s_side" variable.

If "x" is on the same side as everything else in "s", we just append it.  No cancels are possible.

If "x" and "t" are on the opposite side of the elements in "s", then we multiply the big/little pairs to get favorable cancellations.  Any t_i will successfully combine with any s_i.

At the end of the loop, "total" and "s" are both on the same side and no further favorable cancellations are possible.
History
Date User Action Args
2020-08-06 23:02:44rhettingersetrecipients: + rhettinger, tim.peters, mark.dickinson, veky, pablogsal, Jeffrey.Kintscher
2020-08-06 23:02:44rhettingersetmessageid: <1596754964.27.0.869376635422.issue41458@roundup.psfhosted.org>
2020-08-06 23:02:44rhettingerlinkissue41458 messages
2020-08-06 23:02:44rhettingercreate