PEP0238 lament

Jan Dries jdries at mail.com
Sun Jul 22 20:31:14 EDT 2001


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.

Jan




More information about the Python-list mailing list