PEP0238 lament

Stephen Horne steve at lurking.demon.co.uk
Mon Jul 23 02:39:16 EDT 2001


On Mon, 23 Jul 2001 01:31:14 +0100, Jan Dries <jdries at mail.com> wrote:

>Grant Edwards wrote:
>> No, it doesn't.  Integer division is integer division.  The
>> correct answer for the value of 3/4 is 0.  If you wanted the
>> remainder, you should ask for it.  If you want to divide
>> floating point numbers, you should _use_ floating point numbers.
>> 
>> Perhaps my mind was warped by using nothing but integer
>> arithmatic in my software for many years because floating point
>> was simply too slow and too expensive.
>
>Upon reading this and other threads on the subject I wondered why
>apparently a number of people find 3/4 giving 0 odd, while I don't
>remember ever having and certainly don't ever make a mistake against it.
>But now I realise why. I too for many years used nothing but integers
>because fp was, indeed, simply too slow. I even remember calculating
>bezier curves for vector font outlines using only +, >> and << on ints,
>because even integer multiplication was too slow.

Surely it goes deeper than that?

Children learn to count integers very young, and they learn integer
division almost as soon as they start school. They learn about
remainders almost as soon. Fractions, decimals and scientific notation
don't come until much later. The confused expectation about getting
floats as a result instead of integers simply shows that a lot of
children forget the core principles on which their knowledge is based.




More information about the Python-list mailing list