CT - Lecture 3 - Number Systems
CT - Lecture 3 - Number Systems
345 is really
3 x 100 + 4 x 10 + 5 x 1
3 x 10^2 + 4 x 10^1 + 5 x 10^0
3 is the most significant symbol (it carries the most weight)
5 is the least significant symbol (it carries the least weight)
BINARY NUMBER SYSTEM
134 (base 5)
1 x 5^2 + 3 x 5^1 + 4 x 5^0
25 + 15 + 4
44 (base 10)
DECIMAL TO ANY BASE CONVERSION
Divide decimal values by the base until the quotient is 0. The remainders give the digits
of the value.
36 (base 10) to base 2
(binary) 14 (base 10) to base 2
(binary)
36/2 = 18 r=0 <-- lsb 14/2 = 7 r=0 <--
18/2 = 9 r=0 lsb
9/2 = 4 r=1 7/2 = 3 r=1
4/2 = 2 r=0 3/2 = 1 r=1
2/2 = 1 r=0 1/2 = 0 r=1 <--
1/2 = 0 r=1 <-- msb msb
Divide decimal values by the base until the quotient is 0. The remainders give the digits
of the value.
38 (base 10) to base 3 100 (base 10) to base 5
38/3 = 12 r=2 <-- ls 100/5 = 20 r=0
digit 20/5 = 4 r=0
12/3 = 4 r=0 4/5 = 0 r=4
4/3 = 1 r=1
1/3 = 0 r=1 <-- ms 100 (base 10) = 400 (base 5)
digit
write down the 3 bit binary code for each octal digit
example:
5 0 1
101 000 001
HEXADECIMAL TO BINARY CONVERSION
write down the 4 bit binary code for each hexadecimal digit
example:
3 9 c 8
0011 1001 1100 1000
OCTAL – BINARY REFERENCE TABLE
HEXADECIMAL – BINARY REFERENCE TABLE
HEXADECIMAL – OCTAL CONVERSION
Alternatively, this conversion could be done through the decimal number system as well.
BINARY AND NON-BINARY FRACTIONS
BINARY FRACTIONS
The decimal value is calculated in the same way as for non-fractional numbers, the
exponents are now negative.
BINARY FRACTIONS TO DECIMAL CONVERSION
example:
101.001 (binary)
1 x 2^2 + 1 x 2^0 + 1 x 2^-3
4 + 1 + 1/8
5 1/8 = 5.125 (decimal)
2^-1 = .5
2^-2 = .25
2^-3 = .125
2^-4 = .0625 etc.
DECIMAL FRACTIONS TO BINARY CONVERSION
fraction fraction x 2
Consider left and right of
the decimal point .8 1.6 1 (MS)
separately. .6 1.2 1
The integer part can be
converted to binary as .2 0.4 0
before. .4 0.8 0
Use the following algorithm .8 (it must repeat from here!)
to convert the fractional
part.
.8 is .1100
NON-BINARY FRACTIONS