Documente Academic
Documente Profesional
Documente Cultură
Now , how to create binary... look at the below table... Notice how each number is
twice the number above it. (for example... x and underneath is is x+x)
1
2
4
8
16
32
64
128
256
512
so, counting the 0s and 1s from the bottom, you would read 22 as....
010110
Use the following steps for binary subtraction: (Assume the two numbers are x and
y)
1. Take one of the two numbers that we are subtracting and take the complement of
it.
2. Add this to the other operand and add 1 to it.
Solved example 1:
0100 - 0011
If you are told that the numbers are signed, we take the sign bit into consideration.
If the bit is unsigned, we don't care about the signed bit.
In this case, we get the same answer.
Solved example 2:
0011 - 0100
The extra bit (first from the left) we have is the carry-out = 0
The sign bit (second from left) we have is = 1 .. so the number is negative. So, we
get the absolute value is ~(1111)+1 = 0001
If you are told that the numbers are signed, we take the sign bit into consideration.
If the bit is unsigned, we don't care about the signed bit. So, in that case, we get 1
and not -1.
Please check the rules for signed and unsigned that your book follows. It has
different implementations as well.
Binary multiplication
For binary multiplication, remember that binary operates in the base 2 system.
With that said, the only multiplication facts you need to remember are 0 x 0 = 0 ,0 x
1 = 0 ,1 x 0 = 0 ,1 x 1 = 1 . Work the problem the same as you would for
multiplying decimal numbers. 10101010 * 1, write your answer, next line would
have a place holder 0 then multiply by the next number. After you multiply by all
numbers, add the answer columns up and you'll have your answer.
+(0x2^2)+(0x2^1)+(1x2^0)
=81--------(decimal)
11-------------(binary)
=(1x2^1)+(1x2^0)
=3-------------(decimal)
Explanation:
27-------------decimal
27/2=13------1(remainder a1)
13/2=6--------1(remainder a2)
6/2=3-----------0(remainder a3)
3/2=1-----------1(remainder a4)
1/2=0-----------1(remainder a5)
(i)
110111 / 1011 (change binary to decimal)
=55/11
=5 (change decimal to binary)
=101
(ii)
111.0000------------(binary)
=(1x2^2)+(1x2^1)+(1x2^0)+(0x2^-1)
+(0x2^-2)+(0x2^-3)+(0x2^-4)
=7----------------(decimal)
1.01----------------(binary)
=(1x2^0)+(0x2^-1)+(1x2^-2)
=1.25------------(decimal)
7/1.25=5.6-----------(decimal)
5.6=5+0.6---------(decimal)
5/2=2-------1(remainder a1)
2/2=1--------0(remainder a2)
1/2=0--------1(remainder a3)
Count from bottom to top
a3 a2 a1
5=101
(101 is binary number for decimal 5)
So,
5.6----------(decimal)
=a3 a2 a1 . a-1 a-2 a-3 a-4 a-5 a-6 a-7 a-8 .....
=101.10011001..... ---------(binary)
5.6 = 101.1001100110011001.......
number:1345765.3
scientific: 1.3457653E+06
engineering: 1.3457653E+06
number: 0.01655
scientific: 1.655E-02
engineering: 16.55E-03
number: 14500
scientific: 1.4500E+04
engineering: 14.500E+03
The engineering notation allows for a relative easy comparison of numbers in terms
of standard units of thousands (e.g. ksi, kg) and millions (e.g. msi, MPa).