Chapter 1Data Representation |
Modified: |
Digital devices use binary numbers.
Decimal numbers are arranged with the most significant digit on left side and least significant digit on right.
A 16-bit binary number:
1.3.3 Storage sizes
Standard sizes in bits:
Ranges of Unsigned Integers:
Must know number of bits used to represent data.In the following for convenience we'll use just 4 bits to represent numbers.
Unsigned 4 bit numbers Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Unsigned 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
Bits Range Decimal Binary 4 0 to 24-1 0 to 15 00002 to 11112 8 0 to 28-1 0 to 255 000000002 to 111111112 16 0 to 216-1 0 to 65535 00000000000000002 to 11111111111111112 n 0 to 2n-1

Both positive and negative numbers, a specific representation must be selected.
Normally the leftmost bit is used as a sign bit. 0 implies positive or + and 1 implies negative or -.
0011 = 3 0101 = 5 3 3 0011 1011 = -3 1101 = -5 -5 +(-5) +1101 -2 -2 10000 = -0
0011 = 3 0101 = 5 3 3 0011 1100 = -3 1010 = -5 -5 +(-5) +1010 -2 -2 1101 = -2
0011 = 3 0101 = 5 3 3 0011 1's 1100 = -3 1010 = -5 -5 +(-5) +1011 +1 +1 -2 -2 1110 = -2 2's 1101 1011
Question - Using 6-bit values:
- Represent -17 as 2's complement.
- Represent 10 as 2's complement.
- 10+(-17) using 2's complement representation.
- Show that the 2's complement result of Question 3 is correct by converting to decimal.
Signed magnitude, One's and Two's Complement 4-bit numbers Decimal Signed
MagnitudeOne's
ComplementTwo's
Complement0 0000 0000 0000 1 0001 0001 0001 2 0010 0010 0010 3 0011 0011 0011 4 0100 0100 0100 5 0101 0101 0101 6 0110 0110 0110 7 0111 0111 0111 -0 1000 1111 None -1 1001 1110 1111 -2 1010 1101 1110 -3 1011 1100 1101 -4 1100 1011 1100 -5 1101 1010 1011 -6 1110 1001 1010 -7 1111 1000 1001 -8 None None 1000
Bits Range Decimal Binary 4 -24-1 to 24-1-1 -8 to 7 10002 to 01112 8 -28-1 to 28-1-1 -128 to 127 100000002 to 011111112 16 -216-1 to 216-1-1 -32768 to 32767 10000000000000002 to 01111111111111112 n -2n-1 to 2n-1-1
Characters are represented by a code number, the character A is number code 6510 or 4116, or 010000012.Character 7 is number code 5510 or 3716, or 001101112.
Character A is in row 4 and column 1 so is code 4116.
Character M is in row D16 and column 4 so is code D416.
ASCII chart
|
|
![]() |
Boolean operations
Operation Precedence
- Not
- And
- Or
Truth table for ØX v Y