Professional Documents
Culture Documents
Conversion:
1. Decimal to Binary
(74)10 = (1001010)2
(0.625)10 = (?)2
0.625*2 = 1.25
0.25*2 = 0.5
0.5*2 = 1
kpnepal10@gmail.com Page 1
Number System 2010
Do this:
1. (8.75)10 -> (?)2
2. (0.8125)10 -> (?)2
2. Decimal to Octal
Ex: (74)10 = (?)8
(74)10 = (112)8
Ex: (.96)10 = (?)8
Fraction Fraction *8 Remainder Integer
0.96 7.68 .68 7(MSD)
.68 5.44 .44 5
.44 3.52 .52 3
.52 4.16 .16 4
.16 1.28 .28 1(LSD)
And so on
(.96)10 = (.75341)8
3. Decimal to Hexadecimal
Ex: (256)10 = (?)16
kpnepal10@gmail.com Page 2
Number System 2010
(256)10 = (100)16
Ex: (952)10 = (?)16
(952)10 = (3B8)16
Binary System
• A number expressed in binary form i.e 0 and 1. It is represented by base
2. eg (10)2
• Computer use this number system for their internal processing.
• 1 indicates high voltage and o indicates low voltage.
• 1 is yes or on and 0 is no or off.
• Invented by Francis Bacon in 1623 AD
Conversion:
1. Binary to Decimal
Ex: (1101)2 -> (?)10
=1*23 +1*22 +0*21 + 1*20
=1* 8 + 1*4 +0*2 + 1*1
kpnepal10@gmail.com Page 3
Number System 2010
=8 +4 + 0 + 1
=13
2. Binary to Octal
Ex: (101010)2 ->(?)8
101010 ->101 010
101 ->5
010 ->2
(101010)2 -> (52)8
1 3 5 4
(1011.1011)2-> (13.54)8
3. Binary to Hexadecimal
Ex: (1010101011)2 -> (?)16
0010 1010 1011
2 10 11
A B
kpnepal10@gmail.com Page 4
Number System 2010
Conversion
We know, We know,
5=101 2=010
2=010 7=111
kpnepal10@gmail.com Page 5
Number System 2010
4->100
(101)(110).(011)(100)
Adding
(56.34)8-> (101110.011100)2
2. Octal to decimal
3. Octal to hexadecimal
(52)8 = (?)16 (127)8 = (?)16
We know. We know,
2=010 7=111
5=101 2=010
1=001
kpnepal10@gmail.com Page 6
Number System 2010
=(101010)2
=(1010111)2
1010=A
0010=2 0111=7
101=5
=(2A)16
=(57)16
Ex: (6.57)8->(?)16
6->110
5->101
7->111
(6.57)8->(110.101111)2
110 . 1011 11
0110 . 1011 1100
Adding
6 . B C
(6.57)8-> (6.BC)16
kpnepal10@gmail.com Page 7
Number System 2010
Conversion
1. Hexadecimal to Binary
Ex: (6D.3A)16 ->(?)2
6->110
D->1101
3->11
A->1010
(6D.3A)16 ->(1101101.00111010)2
2. Hexadecimal to Octal
Ex: (D.3A)16 ->(?)8
D->1101 Adding 0 in front
3->11(0011)
A->1010
(D.3A)16 ->(1101.00111010)2
Adding 0 back side
3. Hexadecimal to Decimal
Ex: (2B6)16 ->(?)10
2*162 + B*161 + 6*160
2*256 +B *16 +6
512+176+6
694
kpnepal10@gmail.com Page 8
Number System 2010
(2B6)16 ->(694)10
kpnepal10@gmail.com Page 9
Number System 2010
Binary Algebra
1. Binary Addition
0+0=0
1+0=1
0+1=1
1 + 1= 10 (0 with a carry over 1)
Example:
011001
110001
1001010
2. Binary Subtraction
0-0=0
1-0=1
0 - 1 = 1(with borrowing 1)
1 - 1= 0
Example:
110001
011001
011000
3. Binary Multiplication
0 * 0=0
1 * 0=1
0 * 1=1
1 * 1=1
Example:
kpnepal10@gmail.com Page 10
Number System 2010
4. Binary Division
0 ÷ 0=0
1 ÷ 0 = (not defined)
0 ÷ 1=1
1 ÷ 1=1
kpnepal10@gmail.com Page 11
Number System 2010
1’s Complement
9’s Complement
-is obtained by subtracting each digit’s from 9
10’s Complement
-10’s Complement of a decimal number is obtained by adding 1 to
the 9’s Complement of a number
Ex: 9’s complement of 73 is 26
10’s Complement of 73 is 26+1 =27
Now,
Now, 73 - 23 = 50
73 + (10’s complement of 23 i.e 77) =150(ignore 1 as we are doing for 2
bit only)
Ex:
73-77 -> the result will be in 10’s complement form
73-77 = -4
kpnepal10@gmail.com Page 12
Number System 2010
10’s Complement of 26 is 74
10’s Complement of 43 is 57
1’s Complement
-is obtained by subtracting each bit from 1.
Eg: 1’s complement of 1010 is 0101
Steps:
1. Make the both numbers having same number of bits
2. Determine the 1’s complement of the number to be subtracted
(subtrahend).
3. Add the 1’s complement to the given number from which we subtract
(minuend).
4. If there exists any additional bit (carry) in the result after addition,
remove and add it to the result else (i.e if there exits no any carry)
determine the 1’s complement of the result and prefix by negative
sign to the final result.
Example:
a. Subtract 100110 from 110001
1’s complement of 100110 is 011001
Add it with minuend (110001) 110001
1001010
So there exits a carry bit so add it
001010
+1
001011
So the difference is 1011
kpnepal10@gmail.com Page 13
Number System 2010
110100
2’s Complement
Steps:
1. Make the both numbers having same number of bits
2. Determine the 2’s complement of the number to be subtracted
(subtrahend).
3. Add the 2’s complement to the given number from which we subtract
(minuend).
4. If there exists any additional bit (carry) in the result after addition,
neglect the carry bit and remaining is the result else (i.e if there exits
no any carry) determine the 2’s complement of the result and prefix
by negative sign to the final result.
Example:
a. Subtract 100110 from 110001
b. Subtract 110001 from 100110
kpnepal10@gmail.com Page 14
Number System 2010
8 bit representation
7 bit is used to represent the number and
1 bit is used to represent the sign
-9 can be represented as
Signed- magnitude 1 0001001
1’s Complement method 1 1110110
2’s Complement method 1 1110111
N= mre
Where m= mantissa
r = radix of the number system
e = exponent
kpnepal10@gmail.com Page 15
Number System 2010
Gray Code:
Gray Code is a binary code used in shaft encoder which indicates the
angular position of a shaft in digital form.
The binary bits are arranged in such a way that only one binary bit
changes at a time when we make a change from any numbers to the next.
So, largest possible error will be one least significant digits.
Used in computer controlled lathes.( Machine tool for shaping metal or
wood)
Eg: 7 -> 8 (7 to 8)
Gray Code -> 0100 -> 1100
In binary ->0111 -> 1000
If u miss one in binary u miss every thing but in gray code if u miss 1 then
it will be 7 .( miss indicated not detected by sensors.)
kpnepal10@gmail.com Page 16
Number System 2010
Excess-3 Code:
ASCII Code:
American Standard Code for Information Interchange (ASCII).
ASCII-8 Code:
- 8 bit code
- Capacity -> 256 character
EBCDIC Code :
Extended binary coded Decimal information interchange Code.
Used for large computer
Is 8 bit without parity, for parity 9th bit is used.
In ASCII-8 and EBCDIC
- First 4 bit is known as zone bit
- Next 4 bit is a digital values
kpnepal10@gmail.com Page 17
Number System 2010
In ASCII
- First 3 bit zone bits
- Remaining 4 digit values
A 32 bit world length computer might have registers with a capacity 32 bits and
transfer data and instructions within the CPU with a group of 32 bits.
kpnepal10@gmail.com Page 18