Author mark.dickinson
Recipients Sergey.Kirpichev, asmeurer, mark.dickinson, rhettinger
Date 2021-03-07.12:16:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1615119396.33.0.0908367369226.issue43420@roundup.psfhosted.org>
In-reply-to
Content
> There is one exception I've found: stdlib's statistics module uses
> Fraction's in the _sum() helper, exactly in a paradigm "sum a lot
> of values".

That's an interesting example: it does indeed satisfy the "sum of a lot of values" part, but not the "incompatible denominators" part. :-) The typical use there is that those fractions have been converted from floats, and so all denominators will be a smallish power of two. So we don't encounter the same coefficient explosion problem that we do when summing fractions with unrelated denominators. I have many similar use-cases in my own code, where numerators and denominators don't tend to ever get beyond a few hundred digits, and usually not more than tens of digits.

Thanks for the timings! So assuming that wasn't a specially-chosen best case example, the crossover is somewhere around numerators and denominators of ten digits or so.

> It's not going to be complicated so much

For me, the big difference is that the current code is obviously correct at a glance, while the proposed code takes study and thought to make sure that no corner cases are missed.

Shrug. Put me down as -0.
History
Date User Action Args
2021-03-07 12:16:36mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, Sergey.Kirpichev, asmeurer
2021-03-07 12:16:36mark.dickinsonsetmessageid: <1615119396.33.0.0908367369226.issue43420@roundup.psfhosted.org>
2021-03-07 12:16:36mark.dickinsonlinkissue43420 messages
2021-03-07 12:16:35mark.dickinsoncreate