[Tutor] difference between signed integers and unsigned integers
R. Alan Monroe
amonroe at columbus.rr.com
Wed Jan 21 12:18:39 EST 2004
> Hi,
> i know my question is not directly related to
> python. but i just have started the programming in
> python. so i am not a profesional programmer or an
> expert. and i am only subscribed to the python's
> mailing lists. thats why i am asking this question on
> this list. i want to know what are signed and unsigned
> integers and what is the difference between them.
The only difference is in your intentions:
(positive)
1
2 6 3 1
8 4 2 6 8 4 2 1
1 0 0 0 1 0 0 0 = 136
(negative)
1
2 6 3 1
8 4 2 6 8 4 2 1
1 0 0 0 1 0 0 0 = -120
Same bits, different interpretations.
The only thing to consider is that they "roll over" (like an odometer)
so unsigned byte 255+1 = 0, and signed byte 127+1 = -128 (someone is
bound to correct me if I'm off by one here)
Alan
More information about the Tutor
mailing list