Integer dicision

Steve Holden steve at holdenweb.com
Fri Apr 11 06:35:38 CEST 2008


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 ?

Use C?

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list