Two's Complement
Two's complement is the way most computers represent negative integers.
There are three steps:
work out -19 in binary
1) Work out the number as a positive.
00010011 <-- This equals 19.
2) Inverse the number.
11101100
3) Add 1.
11101101 <-- This equals -19.
Note: The first byte equalling 0 means the number is positive, the first byte equalling 1 means the number is negative.
The range of numbers that can be represented with Two's compliment is -128-127.
Note: The first byte equalling 0 means the number is positive, the first byte equalling 1 means the number is negative.
The range of numbers that can be represented with Two's compliment is -128-127.
Comments
Post a Comment