Lec 04 Slides
Lec 04 Slides
.36 x 16 = 5.76
.3610 = .5C28F16 = .0101 1100 0010 1000 11112
.76 x 16 = 12.16
.16 x 16 = 2.56
.56 x 16 = 8.96
.96 x 16 = 15.36
.36 x 16 = 5.76
.76 x 16 = 12.16
.
.
.
Converting Integers in Other Bases to Decimal
Converting 10110102 to Decimal
Converting Integers in Other Bases to Decimal
Converting 10110102 to Decimal
6 5 4 3 2 1 0
1 0 1 1 0 1 0
= 1 x 26 + 0 x 25 + 1 x 24 + 1 x 23 + 0 x 22 + 1 x 21 + 0 x 20
= 1 x 64 + 0 x 32 + 1 x 16 + 1 x 8 + 0 x 4 + 1 x 2 + 0 x 1
= 64 + 16 + 8 + 2
= 9010
Converting Integers in Other Bases to Decimal
Converting 10110102 to Decimal
6 5 4 3 2 1 0
1 0 1 1 0 1 0
= 26 + 24 + 23 + 21
= 64 + 16 + 8 + 2
= 90
Converting Integers in Other Bases to Decimal
Converting 1010110102 to 15A16 to Decimal
2 1 0
1 5 A
= 1 x 256 + 5 x 16 + 10 x 1
= 256 + 80 + 10
= 34610
Converting Fractions in Other Bases to Decimal
Converting .1011012 to Decimal
Converting Fractions in Other Bases to Decimal
Converting .1011012 to Decimal
-1 -2 -3 -4 -5 -6
. 1 0 1 1 0 1
= 0.70312510
Converting Fractions in Other Bases to Decimal
Converting .1011012 to B416 to Decimal
-1 -2
. B 4
= B x 16-1 + 4 x 16-2
= 11 x 1/16 + 4 x 1/256
= 11 x .0625 + 4 x .00390625
= 0.70312510
Converting Integers in Other Bases to Decimal using Horner’s Method
Converting 715A16 to Decimal
3 2 1 0
7 1 5 A
= 2901810
= 2901810
Converting Numbers in Other Bases to Decimal using Horner’s Method
Converting 715A16 to Decimal
7 1 5 A
= 2901810
.5 C 4 3
= 0.360397338867187510
Unsigned Binary Addition
Adding 17310 to 7810 using binary: Adding 23710 to 20610 using binary:
1 1 1 1 1
173 1010 1101 237 1110 1101
+ 78 +0100 1110 + 206 +1100 1110
251 1111 1011 443 11011 1011 187 in 8 bits
(overflow)
0000
111
1
000
1
0101
10
11
- 0010
00
10
= 0011
110 1
1 001
1100 0100 -2
1 010
101 1
10
01
10
10
1
011
1000
100
1
Subtraction by adding the Two’s Complement
510 - 210 = 310
0000
111
1
000
1
0101 0101
10
11
- 0010 + 1110
00
10
= 0011 = 10011
110 1
1 001
1100 0100 -2
1 010
101 1
10
01
10
10
1
011
1000
100
+14
1
Subtraction by adding the Two’s Complement
510 - 210 = 310
0000
111
1
000
1
0101 0101
10
11
- 0010 + 1110
00
10
= 0011 = 10011
110 1
1 001
1100 0100 -2
1 010
101 1
10
01
10
10
1
011
14 = 16 - 2 = 24 - 2
1000
100
+14
1
83 = 0 1 0 1 0 0 1 1 78 = 0 1 0 0 1 1 1 0
-83 =
Adding Signed 2’s Complement Numbers
Adding -8310 to +7810 : Adding +10910 to +7810 :
1 1011 1011
-83 = 1 0 1 0 1 1 0 1
When adding two positive Signed 2’s Complement numbers, overflow occurs when the result is negative.
When adding two negative Signed 2’s Complement numbers, overflow occurs when the result is positive.
When adding a positive and a negative Signed 2’s Complement number, there can never be overflow.
Author’s “easy” way to know when overflow occurs: Overflow occurs when the carry-in and carry-out of the sign-bit (MSb) differ.