On 5/14/21 12:58 PM, Martin Teichmann wrote:
> Hi Richard,
>
>> I would say that I have enough code that does division of numbers that
>> might be integers that expect it to be relatively efficient as floats,
>> and I suspect so do others, that the backwards breaks would be
>> significant.
> Could I please see an example? This is a real question, by now I ran my 
> prototyped interpreter through quite some libraries, and none made problems 
> like this.
>
> Real world examples I am talking about. Sure, I can easily code an 
> approximation for pi which goes out of hand quickly, but doing this in Python 
> would be just wrong unless you are writing a text book.
>
> Cheers
>
> Martin


Do to company rules, I can't publish the actual code, but the input data
is all integers, and I am building up a curve fit where I sum thousands
of distinct values, some of which are ratios of data. If that division
became an fraction, because the denominators are all different values,
the resultant sum would get to be very big numbers (basiclly the least
common multiple of hundreds of numbers in the range of thousands.

As floats, this sumation is quick. If done with 'exact fractional' math,
I suspect it slows down by several orders of magnitude, going from sub
second to maybe an hour. That would be totally unacceptable.

Yes, the fix would likely be changing one line of the program to force
the results to be a float, but if the program is on the factory floor
and just working. If IT at some point updates the version of python
being used due to some security release being needed, suddenly programs
like this just stop running as they grind to a halt.


_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/M2QCN47WWUAIYWWKYO4OMN3UB54KFMRM/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to