Anda di halaman 1dari 12

Number System

Bit:

The word bit is short for binary digit. A bit consists of one of two values, 0 or 1. A bit is a
smallest unit of data in a computer.

Byte:

A byte also happens to be how many bits are needed to present letters of the alphabet and
other characters. There are eight bits in a byte i.e. “A” would be 01000001.

Number system:

A number system is used for a set of different symbols or digits which represent numerical
values.

There are total 4 number system

 Decimal number system


 Binary number system
 Octal number system
 Hexadecimal number system

Decimal number system

 Most commonly used number system


 It is also called as natural number system
 Contains ten digits
 Starting from “0” and ends at “9”
 Due to this property, decimal number system has base 10
 The digit at right most side is called least significant bit
 The digit at left most side is called as most significant bit

Binary number system

 Consist of two digits only


 These are “0” and “1”
 Due to 2 digits, the base of binary number system is 2
 Binary number system is mostly used by computers
 “0” is used for off (absent bit)
 “1” is used for on (present bit)
Octal number system

 It contains 8 bits
 Starting form 0 ----- 7
 So, base of octal numbers is 8

Hexadecimal number system

 It contains 16 digits
 These are starting from “0” and ends on 15
 The number 10, 11, 12, 13, 14, 15 are represented by A, B, C, D, E, F respectively
 That’s why base of hexadecimal number is 16
 It is required in assembly language programming

CONVERSION

There are about 12 conversions because we can convert each number system in other
number system.

1. Decimal ------------- Binary


2. Decimal ------------- Octal
3. Decimal ------------- Hexadecimal
4. Binary --------------- Decimal
5. Binary--- -------------Octal
6. Binary---- ------------Hexadecimal
7. Octal---- ------------- Decimal
8. Octal---- ------------- Binary
9. Octal---- ------------- Hexadecimal
10. Hexadecimal --------Decimal
11. Hexadecimal --------Binary
12. Hexadecimal --------Octal

Conversion of decimal integer to other number system:


 Divide decimal integer by the base of the number system in which the
number is to be converted
 Write down the remainder in reverse order to get the required number

EXAMPLES
1. DECIMAL TO BINARY

(88) (10)----- (?)2


2 88

2 44 - 0

2 22 - 0

2 11 - 0

2 5 -1

2 2 -1

1 -0

(1011000)2

OR

2 88

2 44 - 0

2 22 - 0

2 11 - 0

2 5 -1

2 2 -1

2 1 -0

0 -1

(01011000)2

2. DECIMAL TO OCTAL

(119) (10)----- (?)8


8 119

8 14 -7

1 -6

(167)8

3. DECIMAL TO HEXADECIMAL

(185)(10) ----- (?)16

16 185

16 11 -9

(B9)16

Converting Fractional Decimal Number to Other Number System

 Multiply the fraction part of decimal number with the base of the system
in which fraction is to be converted.
 The result may have two parts i.e. integer part and fraction part.
 Multiply the resulting fraction with the base again.
 Repeat minimum 5 steps.
 The integral part is written as answer, from top to bottom.

EXAMPLES
DECIMAL TO BINARY
(0.56) ----- (?)2
Result Fractional Part Integral

0.56*2 1.12 .12 1

0.12*2 0.24 .24 0

0.24*2 0.48 .48 0


0.48*2 0.96 .96 0

0.96*2 1.92 .92 1

(.10001)2

DECIMAL TO OCTAL
(0.3)10 ---------------- (?)8

Result Fractional Part Integral

0.3*8 2.4 .4 2

0.4*8 3.2 .2 3

0.2*8 1.6 .6 1
0.6*8 4.8 .8 4

0.8*8 6.4 .4 6

(.23146) 8

DECIMAL TO HEXADECIMAL
(0.3)10 ---------------- (?)16

Result Fractional Part Integral

0.3*16 4.8 .8 4

0.8*16 12.8 .8 12=C

0.8*16 12.8 .8 12=C

(.4CC) 16
Converting Decimal (Integral & Fractional part) To Other
Number System

 Combining both the integral and fractional part

Examples
Convert 88.56 into binary?

Integral part Fractional part

2 88 Result Fractional Integral


Part
2 44 - 0 0.56*2 1.12 .12 1
2 22 - 0
0.12*2 0.24 .24 0
2 11 - 0 0.24*2 0.48 .48 0
2 5 -1 0.48*2 0.96 .96 0

2 2 -1 0.96*2 1.92 .92 1

1 -0

(1011000)2 (.10001)2

Combining both the integral and fractional part

(1011000.10001)2

Convert 119.3 into Octal?

Integral Part Fractional Part

Result Fractional Integral


8 119 Part
0.3*8 2.4 .4 2
8 14 -7
0.4*8 3.2 .2 3
1 -6
0.2*8 1.6 .6 1
0.6*8 4.8 .8 4

0.8*8 6.4 .4 6

(167) 8 (.23146)8

Combining both the integral and fractional part

(167.23146)8

Convert 185.3 into HEXADECIMAL?

Integral part Fractional part

Result Fractional Integral


8 185 Part
8 11 -9 0.3*16 4.8 .8 4

0.8*16 12.8 .8 12=C

0.8*16 12.8 .8 12=C

(B9)16 (4CC)16

Combining both the integral and fractional part

(B9.4CC) 16

Conversion of Binary number to other number system:

4. Binary to Decimal

 Multiply each binary number by 20, 21, 22,….., 2n


 Start multiplying from right side
 Now convert the required number

e.g. (11001)2 -------- (?)10

11001= 1*24+1*23+0*22+0*21+1*20
= 16+8+1

= 25

(25)10

5. Octal to Decimal

 Multiply each binary number by 80, 81, 82,….., 8n


 Start multiplying from right side
 Now convert the required number

e.g. (140)8 --------- (?)10

140= 1*82+4*81+0*80

= 64+32+0

= 96

(96)10

6. Hexadecimal to Decimal

 Each binary number by 160, 161, 162,….., 16n


 Start multiplying from right side
 Now convert the required number

e.g. (5C)16 ------------- (?)10

5C= 5*161+C*160

= 5*161+12*160

= 80+12

= 92

(92)10
Table for 3 bits & 4 bits

8 4 2 1 Number

0 0 0 0 0

0 0 0 1 1

0 0 1 0 2

0 0 1 1 3

0 1 0 0 4

0 1 0 1 5

0 1 1 0 6

0 1 1 1 7

1 0 0 0 8

1 0 0 1 9

1 0 1 0 10=A

1 0 1 1 11=B

1 1 0 0 12=C

1 1 0 1 13=D

1 1 1 0 14=E

1 1 1 1 15=F

7. Binary to Octal

 Take the given number


 Make combination/groups of 3 bits
 Start making groups from right side
 Change in the octal number
e.g. (100101110)2 = (?)8

100 101 110

100= 1*22+0*21+0*20 = 4

101= 1*22+0*21+1*20 = 4+1= 5

110= 1*22+1*21+0*20 = 4+2= 6

= (456)8

Or From table we write the values against each number.

100 101 110

4 5 6 (from table)

(456)8

8. Binary to Hexadecimal

1. Take the given number


2. Make combination/groups of 4 bits
3. Start making groups from right side
4. Change in the hexadecimal number

e.g. (0010110001101011)2 = (?)16

0010 1100 0110 1011

2 C 6 B (from table)

(2C6B)16

Or

0010= 0*23+0*22+1*21+0*20 = 2

1100= 1*23+1*22+0*21+0*20 = 8+4= 12=C

0110= 0*23+1*22+1*21+0*20 = 4+2= 6

1011= 1*23+0*22+1*21+1*20 = 8+2+1= B


(2C6B)16

9. Octal to Binary

 Take octal number


 Write equivalent code for each digit in bit (3 bits)
 Combine all bits
 We get the required results

(456)8 = (?)2

4 5 6

100 101 110 (from table)

(456)8 = (100101110)2

10. Octal to Hexadecimal

 Take given number


 Change in bits (3 bits)
 Make groups of 4 bits
 Start grouping from right
 Write equivalent of each group

(456)8= (?)16

4 5 6

100 101 110 (convert in 3 bits, from table)

100101110 (combine bits)

0001 0010 1110 ( make groups of 4 bits and write equivalent number from table )

1 2 E

= (12E)16
11. Hexadecimal to Binary

 Take number
 Write binary code for each number (4 bits)
 It is the result

(2C6B)16 = (?)2

2 C 6 B

0010 1100 0110 1011

(from table)

(0010110001101011)2 (combine all bits)

12. Hexadecimal to Octal

 Take number
 Write binary equivalent (4 bits)
 Make groups of 3 bits
 Change in octal number

(12E)16 = (?)8

1 2 E

0001 0010 1110 (convert in 4 bits, from table)

(12E)16 = 000100101110 (combine bits)

000 100 101 110 (make groups of 3 bits and write equivalent number from table)

0 4 5 6

= (0456)8

Anda mungkin juga menyukai