| Author |
Bit representation of negative numbers
|
Gjorgi Var
Ranch Hand
Joined: Feb 24, 2004
Posts: 85
|
|
Bit representation of 32-bit integer 1 would be: 0000 0000 0000 0000 0000 0000 0000 0001 as it is positive number... but -1 is represented as all 1's? 1111 1111 1111 1111 1111 1111 1111 1111 How come it's all 1's? Shouldn't 1 be just the first bit?
|
 |
Michael Ernest
High Plains Drifter
Sheriff
Joined: Oct 25, 2000
Posts: 7292
|
|
|
What do you think would happen if you added 1 to this number?
|
Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
|
 |
Rick O'Shay
Ranch Hand
Joined: Sep 19, 2004
Posts: 531
|
|
Negatives are two's complement. http://en.wikipedia.org/wiki/Two's_complement
|
 |
 |
|
|
subject: Bit representation of negative numbers
|
|
|