A use for integer quotients

Tom Jenkins tjenkins at nospiced.ham.devis.com
Tue Jul 24 11:39:01 EDT 2001


Rainer Deyke wrote:

> "Paul Foley" <see at below> wrote in message
> news:m2wv4yhm6v.fsf at mycroft.actrix.gen.nz...
> 
>>If you want integers, write floor(a,b) [or floor(a/b)], since that's
>>what you really mean.
>>
> 
> That would be incorrect though.  When I write "a / b", I mean "the largest
> integer 'c' such that c * b <= a".  I don't mean "some approximation loosely
> resembling a / b", which floating point calculations give me.
> 


Correct, that would be incorrect <3.0/4 wink>.  To _really_ get what one 
wants, one would have to write divmod(a,b)[0] which is, ummm, well, just 
plain ugly.

now-i-wonder-how-Parrot-handles-this-ly yours
Tom




More information about the Python-list mailing list