Professional Documents
Culture Documents
Solution:
20
2 41 r 1 LSB
10
2 20 r 0
5
2 10 r 0 4110 = 1010012
2
2 5 r 1
1
2 2 r 0
0
2 1 r 1 MSB
• Example: convert the number 333 to binary.
Division Quotient Remainder Binary
333/2 166 1 1
166/2 83 0 01
83/2 41 1 101
41/2 20 1 1101
20/2 10 0 01101
10/2 5 0 001101
5/2 2 1 1001101
2/2 1 0 01001101
1/2 0 1 101001101
18
Dec → Binary : More Examples
a) 1310 = ?
b) 2210 = ?
c) 4310 = ?
d) 15810 = ?
Dec → Binary : More Examples
a) 1310 = ? 11012
b) 2210 = ? 101102
c) 4310 = ? 1010112
d) 15810 = ? 100111102
Binary → Dec : Example
Convert the binary number 100102 into its decimal equivalent.
Solution:
1 0 0 1 0
24 23 22 21 20
16 8 4 2 1
16 + 0 + 0 + 2 + 0 = 1810
\100102 = 1810
Binary → Dec : Example
Convert the binary number 01101012 into its decimal equivalent.
Solution:
0 1 1 0 1 0 1
26 25 24 23 22 21 20
64 32 16 8 4 2 1
0 + 32 + 16 + 0 + 4 + 0 + 1 = 5310
\01101012 = 5310
Binary → Dec : More Examples
a) 0110 2 = ?
b) 11010 2 = ?
c) 0110101 2 = ?
d) 11010011 2 = ?
Binary → Dec : More Examples
a) 0110 2 = ? 6 10
b) 11010 2 = ? 26 10
c) 0110101 2 = ? 53 10
d) 11010011 2 = ? 211 10
Summary & Review
Base10 Successive
Division
Base2
DECIMAL BINARY
a) Divide the Decimal Number by 2; the remainder is the LSB of Binary Number .
b) If the Quotient Zero, the conversion is complete; else repeat step (a) using the Quotient as the
Decimal Number. The new remainder is the next most significant bit of the Binary Number.
Base2 Weighted
Multiplication
Base10
BINARY DECIMAL
a) Multiply each bit of the Binary Number by it corresponding bit-weighting factor (i.e. Bit-0→2 0=1; Bit-
1→21=2; Bit-2→22=4; etc).
b) Sum up all the products in step (a) to get the Decimal Number.
Binary Addition
We are familiar with adding decimal (base-10) numbers. But
how do we add binary numbers? Consider the equation you
encountered in first grade:
1+1=2
Using n bits the largest binary integer that can be stored is:
Negative Binary Numbers
Let the leftmost bit represent the sign, say 0 for positive and
1 for negative.
The remaining bits represent the magnitude.
For example, suppose we store integers in four bits with the
sign and magnitude scheme. Then 3 would be stored as:
0011
and -2 would be stored as
1010
The addition of 3 and – 2. Using addition in the typical way,
we would see:
3 0011
-2 1010
overload