long int behaviour
Timothy Grant
tjg at exceptionalminds.com
Wed Feb 28 20:29:37 EST 2001
Hi again,
I have a question about longs that has come about due to my
question and the discussion of IP math a couple of days ago.
I'm doing ok on the math part, I still have some issues I need
to work through, but I think I will have it all nailed down
shortly (the exercise has been very informative and
educational). I do have a question about longs and their
behaviour. Given the following experimenting...
>>> hex(4294965248L)
'0xFFFFF800L'
>>> hex(~4294965248L)
'-0xFFFFF801L'
>>>
The first output is what I would expect, however, I would have
expected the second output to be
0x000007FFL
It appears to be something to do with two's complement storage,
but I'm at a loss as to why my expectations were so incorrect.
--
Stand Fast,
tjg.
Timothy Grant tjg at exceptionalminds.com
Red Hat Certified Engineer www.exceptionalminds.com
Avalon Technology Group, Inc. <>< (503) 246-3630
>>>>>>>>>>>>>Linux, because rebooting is *NOT* normal<<<<<<<<<
>>>>This machine was last rebooted: 43 days 5:37 hours ago<<
More information about the Python-list
mailing list