re OnInteger division

Fredrik Lundh fredrik at pythonware.com
Wed Nov 7 13:07:54 EST 2001


John Thingstad wrote:
> To achive a inverse you need to use the modulo as well
>
> so:
> 9/4 = 2
> 9 %4 = 1
>
> and
> (9/ 4) *4 + (9%4) = 9

on the other hand,

>>> from __future__ import division
>>> (9/4)*4 + (9%4)
10.0

oh well.

</F>





More information about the Python-list mailing list