NUMBER SYSTEMS
1. DECIMAL – it represents 10 symbols from 0-9
2. BINARY – it represents 2 symbols from 0-1
3. OCTAL – it represents 8 symbols from 0-7
4. HEXADECIMAL – it represents 16 symbols from 0-9, A-F
Xn
If n is 2 = binary, if n=8 octal, if n=16 hexadecimal, if n=10 decimal
N means subscript, base, radix
CONVERSION:
1. DECIMAL TO BINARY/OCTAL/HEXADECIMAL
3610 1001002
SUCCESSIVE DIVISION
36/2 = 18 rem=0
18/2=9 rem=0
9/2=4 rem=1
4/2=2 rem=0
2/2=1 rem=0
1/2=0 rem=1
===============
3610 448
36/8 = 4 rem=4
4/8=0 rem=4
===============
3610 2416
36/16 = 2 rem=4
2/16 =0 rem=2
2. BINARY/OCTAL/HEXADECIMAL TO DECIMAL
1001002 -> _______
100100
0 x 20 = 0
0 x 21 = 0
1 x 22 = 4
0 x 23 = 0
0 x 24 = 0
1 x 25 = 32
---------
36
448 _______ 10
4 x 80 = 4
4 x 81 = 32
-------------
36
2416 ______10
4 x 160 = 4
2 x 161 = 32
-----------
36
Short method:
Binary to decimal and decimal to binary
3610 1001002
2047 111111111112
1010111012 34910
1 1 1 1 1 1 1 1 1 1 1
1 0 0 1 0 0
======================================================
210 29 28 27 26 25 24 23 22 21 20
1024 512 256 128 64 32 16 8 4 2 1
1 0 1 0 1 1 1 0 1
3. BINARY TO OCTAL/HEXADECIMAL
1100110112 6338
Octal (0-7) equivalent of 7 in binary 111 using 4-2-1 code
Using 3 bits
6 3 3
110 011 011
421 421 421
3 7 4 5 2 5
011 111 100 101 010 101
421 421 421 421 421 421
1100110112 19B16
Hexadecimal (0-F) equivalent of F is 15, 1111 using 8-4-2-1
Using 4 bits
1 9 11 = B
0001 1001 1011
8421 8421 8421
SEATWORK:
Convert the following: 5 points each
DECIMAL BINARY OCTAL HEXADECIMAL
110010101010101
FAÇADE
16317
16735
ARITHMETIC OPERATIONS
BINARY OPERATION
1. ADDITION
0+0=0
0+1=1
1+0=1
1 + 1 = 0 CARRY 1
1 + 1 + 1 = 1 CARRY 1
2. SUBTRACTION
0–0=0
0 – 1 = 1 BORROW 1
1–0=1
1–1=0
3. MULTIPLICATION
1 X0=0
1 X1=0
2 X0=0
2 X1=1
4. DIVISION
0/0=0
0/1=0
1/0=0
1/1=1
EXAMPLE:
PERFORM THE INDICATED OPERATIONS
1 1 1 1 1 1 1
1 1 1 0 1 0 1
+ 1 0 0 1 1 1 1
1 1 0 0 0 1 0 0
1
1 1 1
1 1 1 1 1
1 11 1 1 1 1 1
1 1 11 1 1 11 1
1 1 11 1 11 11 1 1 1 1
11 1 1 11 01 0 0 0
1 11 01 0 1 1 0 0
11 0 1 0 1 0 1 0
1 1 1 0 11 1 1 0
01 11 01 1 0 11 01 1
1 1 1 11 11 11 1 1
1 01 0 0 11 0 0 0
11 1 0 1 1 1 0 1
1 1 0 0 0 0 1 1 1 0 1
10 10 0 1 10 10 10 0 1
1 1 1 0 1 1 1 0
1 1 0 0 1 1 1 1
1 1 10 01 01 0 1 1 1
1 0 1 1 1 0 0 1
1 0 0 0 0 1 1 1 0
1 1 1 0 1 1 0 1
1 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
1 1 1 0 1 1 0 1
1 1 1 0 1 1 0 1 0 0
Rem 1/10
1 1 1 0 0 1 0
10 1 1 1 0 0 1 0 1
1 0
1 1
1 0
1 0
1 0
0 1 0
1 0
1
Rem 1/101
1 0 1 1 1 0 0
101 1 1 1 0 0 1 1 0 1
1 0 1
1 0 0 0
1 0 1
1 1 1
1 0 1
1 0 1
1 0 1
0 1
NEGATIVE NUMBER REPRESENTATION
1. SIGN-MAGNITUDE REPRESENTATION
- A bit is added to the left of the most-significant-bit (MSB) to
denote whether a number is positive (0) or negative (1).
- Example: 11101 (the red 1 is the MSB which denotes negative)
- 0110101 (the red 0 denotes positive)
2. ONE’S COMPLEMENT (1’S)
01
10
EXAMPLE: 11010101 --- 00101010
3. TWO’S COMPLEMENT (2’S)
1’S COMPLEMENT + 1 = 2’S COMPLEMENT
EXAMPLE: 11001011 - 00110100 (1’S COMPLEMENT) + 1
00110101(2’S)
EXAMPLE: SOLVE USING 1’S COMPLEMENT
1
36 1 0 0 1 0 0
- 15 + 1 1 0 0 0 0
21 1 0 1 0 1 0 0
DISREGARD
36 100100 (6 BITS)
15 001111
GET THE 1’S COMPLEMENT OF 15
110000
010100
+ 1
------------ --
0 1 0 1 0 1 (+21)
1 1 1 1 1
15 0 0 1 1 1 1
- 36 + 0 1 1 0 1 1
-21 1 0 1 0 1 0
Msb = negative
15 001111
36 100100
Get the 1’s complement of 36
011011
101010 (true value of negative 21)
Get the 1’s complement to get the true value of 21
101010 reverse 010101 (+21)
ASSIGNMENT:
Perform the indicated operation:
11110010101 + 10101010 =
11110000 + 10101010 + 11111111 + 11001100 =
11111111 – 11001100 =
110000110011 – 1010101010 =
11110000 x 101 =
110011001100 / 110 =
100010001000 / 111 =
Solve using 1’s complement
75-42 =
42-75 =