Integer dicision

jim jim at well.com
Fri Apr 11 00:53:00 EDT 2008


it rounds down. 4 is less than 4.5 
and -5 is less than -4.5. 

On Thu, 2008-04-10 at 21:28 -0700, bdsatish wrote:
> How does (a/b) work when both 'a' and 'b' are pure integers ?
> 
> >> (9/2)
> 4
> 
> >> (-9/2)
> -5
> 
> Why is it -5 ? I expect it to be -4 ? Because, in C/C++, 9/2 is 4 and
> so negative of it, (-9/2) is -4.
> 
> What should I do to get C-like behavior ?




More information about the Python-list mailing list