Professional Documents
Culture Documents
Number System
Binary (Base 2)
Best for computers Only 1s and 0s Example: 1011, 00, 10, 110001, 0000110
Conversion
Binary-to-Decimal
1 23 1 22 0 21 1 20
Decimal-to-Binary
(13)10 = (?)2
Conversion
Binary-to-Hexadecimal
(10001100)2 = (?)16
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F
Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
4
Hexadecimal-to-Binary
(9AF)16 = (?)2
Examples
Convert the following to:
Decimal: 11001001, 11110 Binary: (100)10, (67)10, (100)16, (67)16, CD42 Hexadecimal: 111010001000101111010110
Sign-and-magnitude Method
Use MSB as a sign
If MSB=0, then the sign is + If MSB=1, then the sign is
Signed Numbers
1s Complement Method
Apply NOT operation on each bit to get number in 1s complement form.
2s Complement Method
Add 1 to 1s complement to get 2s complement.
Addition
Rules
0+0 = 0 0+1 = 1 1+1 = 10 1+1+1 = 11
10
Subtraction
Rules:
00=0 10=1 11=0 10 1 = 1
11
Multiplication
Binary multiplication is just a bunch of right shifts and adds n
multiplicand multiplier partial product array
2n
12
Division
Division is just a bunch of quotient digit guesses and left shifts and subtracts n n
0 0 0 divisor 0 0 0 remainder partial remainder array quotient dividend
n
CSC242 L02 Arithmetic Review 13