negative numbers and integer division
Mark Hahn
mark at hahnca.com
Fri Oct 3 15:16:49 EDT 2003
That definitely seems wrong to me, even though it is a correct "floor"
function.
I was given the impression that (int // int) was going to be the replacement
for (int / int) when (int / int) is changed to return a float, but -1/12 now
gives 0, not -1, so (int // int) is not a replacement for (int / int).
"Matthew Wilson" <mwilson at sarcastic-horse.com> wrote in message
news:mailman.1065206646.19185.python-list at python.org...
> Hi-
>
> I just discovered this:
>
> >>> -1 // 12
> -1
> >>> 1 // 12
> 0
> >>>
>
> I thought that -1 // 12 would be 0 also. I'm writing a simple monthly
> date class and i need (-1,2001) to be translated to (11,2000). Any ideas?
>
More information about the Python-list
mailing list