simple math question

John Salerno johnjsal at NOSPAMgmail.com
Sat Feb 11 16:42:44 EST 2006


Rinzwind wrote:
> '/' is a floor division (1/2 == 0) unless validated by a from
> __future__ import division.
> 
> So:
> 5/2=2.5 -> nearest lowest non-decimal number makes it 2.
> 5/-2=-2.5 -> nearest lowest non-decilmal number makes it -3
> 

Ah, this makes the most sense to me. -2.5 rounded down is -3. I guess I 
was thinking of it more in terms of "-2 goes into 5 -3 times", which is 
a little hard to wrap my mind around.



More information about the Python-list mailing list