A use for integer quotients
Stephen Horne
steve at lurking.demon.co.uk
Mon Jul 23 00:35:02 EDT 2001
On Mon, 23 Jul 2001 00:55:58 GMT, "Terry Reedy" <tjreedy at home.com>
wrote:
>During the debate on changing int/int to give a float result, some
>proponents appeared to question the usefulness of integer quotients.
>Opponents of the change gave calculation of array indexes, including
>graphics pixel coordinates, and 'combinatorics' as example uses. I
>here present an particular example of a combinatorial use extracted
>from the recent thread on partitions.
Of course - lets see if I can think of some more...
- Pretty much *all* divide-and-conquer algorithms - e.g. binary
searching ordered lists/tuples
- Crypto algorithms such as RSA
- Heaps - priority queues etc
- Many mathematical algorithms - e.g. fast fourier transform requires
both integer division on integer arguments and float division on
float arguments (but does not need integers to magically turn into
floats).
That's just off the top of my head.
I can think of many uses for float division too - many engineering
applications for instance - but NONE that need integers and floats to
be treated the same way.
More information about the Python-list
mailing list