A use for integer quotients
Stephen Horne
steve at lurking.demon.co.uk
Mon Jul 23 03:20:06 EDT 2001
On Sun, 22 Jul 2001 21:17:33 -0700, David Eppstein
<eppstein at ics.uci.edu> wrote:
>In article <mailman.995860718.9550.python-list at python.org>,
> Moshe Zadka <moshez at zadka.site.co.il> wrote:
>
>> Yes. Nobody said it wasn't of any use, people just claim it is *less*
>> useful, and so should not be the most easily accessible. You can
>> still have i//j for all your combinatorics needs.
>
>I don't suppose it would be possible to go through some repository of
>Python sources and figure out the relative numbers of divisions of integer
>arguments that end up an int versus the ones that are coerced to floats?
>In my own code it's 100% int/int->int but that's a small unrepresentative
>sample. Note I'm less interested in divisions of quantities that are
>already floats as those would be unaffected by this proposal.
I know that mine is 100% - I rarely use floats at all in Python.
But what might be surprising is that in C++ - where I do a lot of
digital signal processing work using floating point values - the
answer is *still* 100%. If I need floating point division I use
floating point division, but that has always meant that I'm using
floating point arguments. The worst I found is a few cases if
Sample_Rate / n, or 1.0 / n, or whatever where n was an integer that
got implicitly cast - which Python does already.
Integers and floats are two separate domains - both in implementation
details and in their applications.
More information about the Python-list
mailing list