Вы находитесь на странице: 1из 35

Unit 1.1.

1
INCLUDES:
Number representation
✓ show understanding of the basis of different
number systems and use the binary, denary
and hexadecimal number system

✓ convert a number from one number system


to another

AADITYA RAMAN SINGH

AS ’C’ ROLL.NO.-1

018A065
1
Introduction:
From simple calculations on our fingertips, to complex machines, we have used
many forms of number system. Among these number systems, these number
systems have been widely used :

1. Binary or base 2 number system


2. Octal or base 8 number system
3. Decimal or base 8 number system
4. Hexadecimal or base 16 number system
Bases in number system:
The base in number system represents the number of the different characters that are used
to represent a number in the number system. For example,the binary number system of the
base 2 number system uses the two digits 1 and 0 to represent a number.In this scheme,
the numerals used in denoting a number take different place values depending upon
position.
Number system base No. of characters characters Main use

2 2 0,1 Machine level

8 8 0,1,2,3,4,5,6,7 {a digit represents 3 bit}

10 10 0,1,2,3,4,5,6,7,8,9 (0-9) Normal counting, calculations

16 16 (0-9),A,B,C,D,E,F {a digit represents 4 bit}


Decimal number system:
A decimal number:

1044= 1✕103+0✕102+4✕101+4✕100

Denary or base 10 or decimal number system is the most common form of


representing numeric data.

It consists of 10 different numbers; 0,1,2,3,4,5,6,7,8 and 9


Binary number system:
A binary digit :

(1011101)2=1✕26+0✕25+ 1✕24+1✕23+1✕22+0✕21+1✕20=(93)10

This number system is used to “converse with machines”. A 1 represents on and a


0 represents off . This can easily be understood by a machine.

This number system is also used to construct a truth table, 1 representing true and
0 representing false.
Octal number system
An octal number:

(10473)8= 1✕83+0✕82+4✕81+4✕80=(548)10

Octal or base 8 or number system is a number system that has 8 numbers.

It consists of 10 different numbers; 0,1,2,3,4,5,6 and 7

It is used in machines, especially computers, mainly as a digit can represent 3


bits.
Hexadecimal number system:
A hexadecimal number:

(9AAB)16= 9✕163+A(10)✕162+A(10)✕161+B(11)✕160=(39595)10

Octal or base 16 or number system is a number system that has 8 numbers.

It consists of 16 different numbers; 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E and F

It is used as octal numbers as a digit can represent 4 bits, which is more than that
of the octal number system.
CONVERSION OF NUMBERS FROM
ONE SYSTEM TO ANOTHER
Example conversion:
Number system: Base: Example number: In base 10:

Binary 2 111000101 453

Octal 8 705 453

Decimal 10 453 453

Hexadecimal 16 1C5 453


Conversion of Binary to Decimal:
S.N. Steps: Example with a number:

1 Get a number 1101

2 Seperate the numbers 1 1 0 1

3 Keep an add sign between the numbers 1 +1 +0 +1

4 Multiply each of the numbers with 2 1✕2+1✕2+0✕2+1✕2

5 Raise the power of 2 from 0 starting with the right 1✕23+1✕22+0✕21+1✕20

6 Keep the values of the 2s, raised to their power. 1✕8+1✕4+0✕2+1✕1

7 Simplify 8+4+0+1

8 Add the numbers 13


Conversion of Octal to Decimal:
S.N. Steps: Example with a number:

1 Get a number 724

2 Seperate the numbers 7 2 4

3 Keep an add sign between the numbers 7 +2 +4

4 Multiply each of the numbers with 8 7✕8+2✕8+4✕8

5 Raise the power of 8 from 0 starting with the right 7✕82+2✕81+4✕80

6 Keep the values of the 8s, raised to their power. 7✕64+2✕8+4✕1

7 Simplify 448+16+4

8 Add the numbers 468


Conversion of Hexadecimal to Decimal:
S.N. Steps: Example with a number:

1 Get a number 273

2 Seperate the numbers 2 7 3

3 Keep an add sign between the numbers 2 +7 +3

4 Multiply each of the numbers with 16 2✕16 +7✕16 +3✕16

5 Raise the power of 16 from 0 starting with the right 2✕162 +7✕161 +3✕160

6 Keep the values of the 16s, raised to their power. 2✕256+7✕16+3✕1

7 Simplify 512+112+3

8 Add the numbers 627


Conversion of Decimal to Number Remainder

Binary: 2 910 0

1. Get a number. 2 455 1


{910} 2 113 1
2. Divide the number several times, until you get the
2 56 0

Answer
dividend 0. Also note the remainder in each case.
2 28 0
3. Since 0 cannot be divided by 2, we stop when the
dividend is zero. 2 14 0
4. The remainder, from top to bottom reads; 2 7 1
011000111. This is not the answer. To get the
2 3 1
answer, we simply reverse this digit. The answer is;
2 1 1
111000110
5. Answer:111000110 0
Conversion of Decimal to Number Remainder

Hexadecimal: 16 910 14

1. Get a number. 16 56 8

{910} 16 3 3
2. Divide the number several times, until you get the 0

Answer
dividend 0. Also note the remainder in each case.
3. Since divided by 16 returns 0 again, we stop when
the dividend is zero.
4. The remainder, from top to bottom reads; 14,8,3.
This is not the answer. To get the answer, we simply
reverse this digit. The answer is; 3,8,14
5. In the answer, numbers 10 - 15 are represented by
A,B,C,D,E,F respectively.
6. Answer: 38E
Conversion of Decimal to Number Remainder

Octal: 8 910 6

1. Get a number. 8 113 1

{910} 8 14 6
2. Divide the number several times, until you get the 8 1 1

Answer
dividend 0. Also note the remainder in each case.
0
3. Since divided by 16 returns 0 again, we stop when
the dividend is zero.
4. The remainder, from top to bottom reads; 6161. This
is not the answer. To get the answer, we simply
reverse this digit. The answer is; 1616
5. Answer: 1616
Conversion of Binary to Hexadecimal:
There are mainly two different ways to convert binary to hexadecimal and vice-
versa :-

1. Normal conversion:
a. Converting Hexadecimal into Decimal
b. Converting Decimal into Binary

And vice versa.

1. Bit conversion:
a. Constructing a comparison table {explained with table}
Conversion of Binary to Octal:
There are mainly two different ways to convert binary to Octal and vice-versa :-

1. Normal conversion:
a. Converting Octal into Decimal
b. Converting Decimal into Binary

And vice versa.

1. Bit conversion:
a. Constructing a comparison table {explained with table}
Bit conversion:
It a from of number conversion in which a number from a number system is
compared with equivalent number in another number system, usually done by
making a table. This type of conversion is not possible for all number systems, but
only for:

1. Octal to binary and vice versa.


2. Hexadecimal to binary and vice versa.

This is possible as the greatest 3 digit binary number is equal to the greatest 1
digit octal number and the greatest 4 digit binary number is equivalent to the
greatest 1 digit hexadecimal number. In case of decimal number system , it is not
so.
From Binary to Octal:
1. Get a number Octal digit: Equivalent
binary digit:
2. Make or obtain a table like the adjacent
0 000
one
3. Group the number into 3 digits, starting 1 001
from the last one.
4. If the first number from the left has less 2 010
than 3 digits, place 0s in front of the
number. 3 011
5. Compare the obtained number with the
4 100
ones in the table.
6. Join the numbers to get the answer. 5 101

6 110

7 111
Example conversion:

Step number: Calculations:

1 101101

2 * * *

3 101 101

4 101 101

5 5 5

6 Answer: 55
From Binary to Hexadecimal:
1. Get a number Hexadecima Equivalent Hexadeci Equivalent
2. Make or obtain a table like the adjacent l digit: binary digit: mal digit: binary digit:
one
0 0000 8 1000
3. Group the number into 4 digits, starting
from the last one. 1 0001 9 1001
4. If the first number from the left has less
than 4 digits, place 0s in front of the 2 0010 A 1010
number.
5. Compare the obtained number with the 3 0011 B 1011
ones in the table.
4 0100 C 1100
6. Join the numbers to get the answer.
5 0101 D 1101

6 0110 E 1110

7 0111 F 1111
Example conversion:

Step number: Calculations:

1 101101

2 * * *

3 10 1101

4 0010 1101

5 2 D(13)

6 Answer: 2D
1’ complement from:
It the system of representation off the binary digits , the the places off the 1s and
0s are interchanged. This is used to represent negative values, or in general
negative numbers.

Example:

35 {decimal}=0100011

-35 {decimal}=1011100
2’ complement form:
1. Two’s complement form is mathematical operation of binary numbers where
those numbers are turned into either positive or negative for calculations to be
performed on the numbers or any other reasons.
2. To determine the binary numbers as positive or negative:
a. A number is taken.
b. A 0 is inserted at the front of the number.
c. The 0s and 1s and switched.
d. 1 is added to the obtained number.
e. The number now represents the negative of the number it previously
represented.
Example:
1. Example 1:
a. Take a binary number 11 (0011). {equivalent decimal=3}
b. After changing 0s into 1, and vice versa,the number obtained is 1100
c. Adding 1 gives the number 1101, which represents the number,(-3)
2. Example 2:
a. A binary number: 1000111 (01000111)
b. Interchanging off the digits: 10111000
c. Adding 1: 10111001
BCD or Binary Coded Digits:
It is the encoding of digits of base 10 , directly converted into binary by
representing them in from of 8 bits.
Note#:
1. It is also called 4 to 1 code
2. It is the simplest binary code for decimal digits
3. Only encodes digits from 0 to 9 {binary numbers for 11,12,13,14 and 15 are
invalid}
4. BCD is a weighted code,meaning in a number, 1011 has weight of 8,4,2,1
starting from the left of the number. That is, 1 has weight of 8, 0 of 4, 1 of two
and 1 of 1. Adding these , we can get the equivalent decimal number of the
binary number.
BCD table comparison with binary table
Decimal value Binary value BCD value Decimal value Binary value BCD value

0 00000 0000 0000 9 01001 0000 1001

1 00001 0000 0001 10 {1+0} 01010 0001 0000

2 00010 0000 0010 11 {1+1} 01011 0001 0001

3 00011 0000 0011 12 {1+2} 01100 0001 0010

4 000100 0000 0100 20 {2+0} 10100 0010 0000

5 000101 0000 0101 21 {2+1} 10101 0010 0001

6 000110 0000 0110 22 {2+2} 10110 0010 0010

7 000111 0000 0111 23 {2+3} 10111 0010 0011

8 01000 0000 1000 30 {3+0} 11110 0011 0000


Example of usage of BCD:
A binary clock might use LEDs to express binary values.
In this clock, each column of LEDs shows a binary-
coded decimal numeral of the traditional sexagesimal
time.

Reading a BCD clock: Add the values of each column of


LEDs to get six decimal digits. There are two columns
each for hours, minutes and seconds.
Advantages of BCD:
1. BCD is common in the electronic devices where numeric data must be
displayed and has solely digital logic, not having any microprocessor.
2. The BIOS in many personal computers stores the date and time in BCD
because the MC6818 real-time clock chip used in the original IBM PC AT
motherboard provided the time encoded in BCD. This form is easily converted
into ASCII for display.
3. The Atari 8-bit family of computers used BCD to implement floating-point
algorithms. The MOS 6502 processor used has a BCD mode that affects the
addition and subtraction instructions.
4. It is faster and efficient than directly converting binary into decimal.
ASCII code:
ASCII or American Standard Code for Information Interchange is the most widely
used and internationally agreed standard to store characters in a computer. In
ASCII, each binary value between 0 and 127 is given a specific character. Some
extended ASCII use the full range of 256 characters.

Different computers have different sets of ASCII codes.


ASCII chart:
Storage of words in ASCII from:
With reference to the table in the previous slide,

Process in storage:: Processing off the word

Get a WORD ApplE

Separate the letters A p p l E

Equivalent ASCII code:{in decimal:} 65 112 112 108 69

Equivalent ASCII code {in BCD:} 01100101000100010010 00010001001000010000100001101001

Thus, the word “ApplE” is saved as :


0110010100010001001000010001001000010000100001101001
Unicode:
Unicode is an international encoding standard which is used to assign each digits,
numbers and symbols with unique numeric values that applies across the globe.

The problem with ASCII is that it only allows you to represent a small number of
characters (~128 or 256 for Extended ASCII). This is only practical for countries
with only english speaking citizens,like in USA, or the UK and also in some
countries, where there is the use of written English to represent the information,
like in Germany.

So, to store more larger numbers of characters we use unicode. There are
different versions of unicode with different bits. Example: UTF-8, UTF-16, UTF-32.
Any queries?

34
Thank you!

35

Вам также может понравиться