0% found this document useful (0 votes)
28 views63 pages

Number Systems

Uploaded by

Raja G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views63 pages

Number Systems

Uploaded by

Raja G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 63

Number Systems

TOPICS

• Decimal Number Systems


• Binary number Systems
• Octal
• Hexadecimal
• Number conversion
Decimal Number System

• The word decimal is a derivative of decem,


which is the Latin word for ten.
• Numbers today are almost universally written

in a form of notation known as positional


number representation.
• A number is represented as a string of digits.
Decimal Number Systems

• In a decimal number there are ten such digits


that may be used, ranging in value from zero to
nine
• Decimal numbers are positional numbers that
have a base or radix of ten.
• Why ten ?
Decimal Number Systems
• Exactly ten distinct numerals in order to
represent all possible values for each position in
the number, and hence to enable us to represent
all possible integer numbers in decimal notation.
• 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 values
• For example, a number like "0123456789" has
ten positions and each position can contain the
digits 0-9.
Decimal Number Systems

• Each digit position has a weight associated


with it.
• Each digit corresponds to a power of 10 based
on its position in the number
• Number’s value = a weighted sum of the digits
Decimal Number Systems

• Number’s value = a weighted sum of the digits


• Number’ value = digit * 10x + digit * 10x where
x = (position number - 1).

It sounds complicated ?
Decimal Number Systems

• The powers of 10 increment from 0, 1, 2,


etc. as you move right to left
Hundreds Tens Units
Decimal Number Systems
• The BASE is 10 or Dec or simply D
• BASE = 10
103=1000
10 3 Power or Exponent
102=100
Base 10
10 =10
1

100=1
Decimal Number Systems

• Example

123410 = 1x 103 + 2x 102 + 3x101 +4x100


= 1000 + 200 + 30 +4
= 123410
Decimal Number Systems

• Example

9876D = 9x 103 + 8x 102 + 7x101 +6x100


= 9000 + 800 + 70 +6
= 9876D
Decimal Number Systems

• Summary
• In the decimal system, there are 10 digits (0
through 9) which combine to form numbers as
follows:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
19 20 21 22 ...
Binary Number Systems
• The term computer numbering formats refers to
the schemes implemented in digital computer and
calculator hardware and software to represent
numbers
• Digital Computers and Calculator use a binary
systems
• Why binary?
Binary Number Systems
• Easy to represent binary values electrically

• Voltages and currents.

• Can be implemented using circuits

• Create the building blocks of modern computers


Binary Number Systems
• Reliability
• With only 2 values, can be widely
separated, therefore clearly
differentiated
• Binary numbers are made of binary
digits
Binary Number Systems
• Binary DigiTs (BITs) can be represented
electronically:
… 0 (no signal)
… 1 (signal)
Binary Number Systems

Base is 2 or ‘b’ or ‘B’ or ‘Bin’

Two symbols: 0 and 1

Each place is weighted by the power of 2


Binary Number Systems
• All the information in the digital computer is
represented as bit patterns
• What is a bit pattern?
This is one bit
01010101
This is called as the bit pattern
Binary Number Systems
• Look at this bit pattern
0101 0101
• How many bits are present ?
• Count the number of ones and the zeros in the
above pattern

Answer = Total 8 bits


Binary Number Systems
0101 0101
This pattern is represented as follows in the digital
computer
Bit7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 1 0 1 0 1 0 1
Binary Number Systems
• A single bit can represent two states:0 1
• Therefore, if you take two bits, you can use them
to represent four unique states:
00, 01, 10, & 11
• And, if you have three bits, then you can use them
to represent eight unique states:
000, 001, 010, 011, 100, 101, 110, & 111
Binary Number Systems

•With every bit you add, you double the number of


states you can represent. Therefore, the expression
for the number of states with n bits is 2n. Most
computers operate on information in groups of 8
bits,
Binary Number Systems
Bit7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 1 0 1 0 1 0 1

• There are 8 bits in the above table


• Group of 4 bits = 1 Nibble
• Group of 8 bits = 1 Byte
• Group of 16 bits = 1 Word 2 Bytes = 1 Word
Binary Number Systems
Bit7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 1 0 1 0 1 0 1

• There are 8 bits in the above table


• Bit 0 is called the Least Significant Bit LSB
• Bit 1 is called the Most Significant Bit MSB
Binary Number Systems
Bit positions and their values
Bit7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0

27 26 25 24 23 22 21 20

128 64 32 16 8 4 2 1
Convert Decimal to Binary
For Each Digit Position

1.Divide decimal number by the base (e.g. 2)

2. The remainder is the lowest-order digit

3. Repeat first two steps until no divisor remains.


Convert Decimal to Binary
Example: Convert Decimal 13 (13 10) to Binary :
Repeated division by 2 (till quotient is zero)
Divide-by -2 Quotient Remainder Binary Bits
13/2 6 1 Bit 0 = 1
6/2 3 0 Bit 1 = 0
3/2 1 1 Bit 3 = 1
1/2 0 1 Bit 4 = 1
Answer = 11012
Convert Binary to Decimal
Example: Convert 11012

Multiply each 1 bit by the appropriate power of 2


and add them together.

1 0 1 1
Bit 3 Bit 2 Bit 1 Bit 0
Convert Binary to Decimal
Example: Convert 11012
Bit7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
1 1 0 1

Multiply with 8 x 1 + 4 x 1 + 2 x 0 + 1x 1 = 8 + 4 + 0 + 1
these values
= 13
Binary Number Systems

Example:
10112 or 1011 B
= 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20
= 8 + 0 + 2 +1
= 1110
Binary Number Systems
Example:
101102 or 10110 B
1 x 24+0 x 23 + 1 x 22 + 1 x 21 + 0 x 20
= 16 + 0 + 4 +2+0
= 2210
Other Number Systems

• Octal and hex are a convenient way to


represent binary numbers, as used by
computers.
• Computer mechanics often need to write out
binary quantities, but in practice writing out a
binary number such as
Other Number Systems

• 1001001101010001
is tedious, and prone to errors.
• Therefore, binary quantities are written in a
base-8 ("octal") or, much more commonly, a
base-16 ("hexadecimal" or "hex") number
format.
Octal Number Systems

• Base = 8 or ‘o’ or ‘Oct’


• 8 symbols: { 0, 1, 2, 3, 4, 5, 6, 7}
• Example 123, 567, 7654 etc
987 This is incorrect why?
• How to represent a Decimal Number using a
Octal Number System ?
Octal Number Systems
• Repeated Division by 8
• Example
21310 = ( )8 ?
Divide-by -8 Quotient Remainder Octal digit
213 / 8 26 5 Lower digit = 5
26 / 8 3 2 Second digit =2
3/8 0 3 Third digit =3
Answer = 3258
Octal Number Systems
• How to convert 3258 back to Decimal ?
• Use this table and multiply the digits with the position
values
Digit Digit Digit Digit Digit Digit Digit Digit
8 7 6 5 4 3 2 1
87 86 85 84 83 82 81 80

…… …… 32768 4096 512 64 8 1


Octal Number Systems
• How to convert 3258 back to Decimal ?
• Consider the above number
3 2 5 (8) Digit 1

Digit 3 Digit 2

3 x 82 + 2 x 81 + 5 x 80 = 3 x 64 + 2 x 8 + 5 x 1
= 192 +16 + 5
= 213
Octal Number Systems
• Example Convert 6118
• Consider the above number
6 1 1 (8) Digit 1

Digit 3 Digit 2

6 x 82 + 1 x 81 + 1 x 80 = 6 x 64 + 1 x 8 + 1 x 1
= 384 + 8 + 1
= 393
Octal Number Systems
• Convert 393 to octal

Divide-by -8 Quotient Remainder Octal digit


393 / 8 49 1 Lower digit = 1
49 / 8 6 1 Second digit =1
6/8 0 6 Third digit =6

Answer = 6118
Hexadecimal Number
Systems
• Base = 16 or ‘H’ or ‘Hex’

16 symbols: { 0, 1, 2, 3, 4, 5, 6, 7,8,9 }

{ 10=A, 11=B, 12=C, 13=D, 14=E, 15= F}


Hexadecimal Number
Systems
• {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F} It uses 6
Letters !
• Example AB12, 876F, FFFF etc

• How to represent a Decimal Number using a


Hexadecimal Number System ?
Hex Number Systems
• Repeated Division by 16
• Example
21310 = ( )16 ?
Divide-by -16 Quotient Remainder Hex digit
213 / 16 13 5 Lower digit = 5
13 / 16 0 13 Second digit =D

Answer = D516
Hex Number Systems
• How to convert D516 back to Decimal ?
• Use this table and multiply the digits with the position
values
Digit Digit Digit Digit Digit Digit Digit Digit
8 7 6 5 4 3 2 1
167 166 165 164 163 162 161 160

…… …… ….. …… 4096 256 16 1


Hex Number Systems
• How to convert D516 back to Decimal ?
• Consider the above number
D 5 (16) Digit 1

Digit 2

D x 161 + 5 x 160 = 13 x 16 + 5 x 1
= 208 + 5
= 213
Binary Number Systems
• A single bit can represent two states:0 1
• Therefore, if you take two bits, you can use them
to represent four unique states:
00, 01, 10, & 11
• And, if you have three bits, then you can use them
to represent eight unique states:
000, 001, 010, 011, 100, 101, 110, & 111
Binary Number Systems
•And, if you have three bits, then you can use them
to represent eight unique states:
These have a perfect correspondence to Octal
000 = Octal 0 100 = Octal 4
001 = Octal 1 101 = Octal 5
010 = Octal 2 110 = Octal 6
011 = Octal 3 111 = Octal 7
Binary Number Systems

•With every bit you add, you double the number of


states you can represent. Therefore, the expression
for the number of states with n bits is 2n. Most
computers operate on information in groups of 8
bits,
Binary Number Systems

• A unit of four bits, or half an octet, is often called

a nibble (or nybble). It can encode 16 different

values, such as the numbers 0 to 15. Any arbitrary

sequence of bits could be used in principle,


Binary Number Systems
, but in practice the most common scheme is:
0000 = decimal 00 hex 0 1000 = decimal 08 hex 8
0001 = decimal 01 hex 1 1001 = decimal 09 hex 9
0010 = decimal 02 hex 2 1010 = decimal 10 hex A
0011 = decimal 03 hex 3 1011 = decimal 11 hex B
0100 = decimal 04 hex 4 1100 = decimal 12 hex C
0101 = decimal 05 hex 5 1101 = decimal 13 hex D
0110 = decimal 06 hex 6 1110 = decimal 14 hex E
0111 = decimal 07 hex 7 1111 = decimal 15 hex F
These have perfect correspondence to Hex
Convert Binary to Hex
• Group into 4's starting at least significant
symbol (if the number of bits is not evenly
divisible by 4, then add 0's at the most
significant end)
• write 1 hex digit for each group
Convert Binary to Hex
Example: Convert 1001 1110 0111 0000 to Hex

After grouping follow the procedure as discussed in


the previous section use the symbols of Hex number
system like 13=E

1001 1110 0111 0000


9 E 7 0
Convert Binary to Hex
Example: Convert 100 1010 011 0000 to Hex

10 0101 0011 0000


This group has only two bits, to make it a group of 4
bits add zeros in MSB position
0010 0101 0011 0000
2 5 3 0
Convert Hex to Binary
• For each of the Hex digit write its binary
equivalent (use 4 bits to represent)
• Example
Convert 25A0 to binary

0010 0101 1010 0000


Convert Binary to Octal
• Group into 3's starting at least significant
symbol (if the number of bits is not evenly
divisible by 3, then add 0's at the most
significant end)
• write 1 octal digit for each group
Convert Binary to Octal
Example: Convert 1001 1110 0111 0000 to Oct

After grouping follow the procedure as discussed in


the previous section use the symbols of Oct number
system like
add two zeros here
001 001 111 001 110 000
1 1 7 1 6 0
Answer = 1171608
Convert Octal to Binary
• For each of the Octal digit write its binary
equivalent
• Example
Convert 2570 to binary

010 101 111 000


Fractional binary to decimal
Example: 101.1012 = 5.62510

0.1012

101

0.1012 = (1 * 2-1) + (0 * 2-
2
) + (1 * 2-3)
1012 = (1 * 22) + (0 * 21) + (1 or
* 20) 0.1012 = (1 * 1/2) + (0 *
or alternatively: 1/4) + (1 * 1/8)
1012 = (1 * 4) + (0 * 2) + (1 * or
1) = 510 0.1012 = (1 * 0.5) + (0 *
0.25) + (1 * 0.125) =
0.62510
Fractional decimal to Binary
• Example 910 = (1 * 23) + (0 * 22) + (0 * 21) + (1
* 20) = 10012
9.12510
Or
910 = (1 * 8) + (0 * 4) + (0 * 2) + (1 * 1) =
10012
Step 1 ---------- We multiply 0.125 by 2 and take the integer
part 0.125 x 2 = 0.250 Integer part = 0 Fractional part = 0.250
As, fractional part is not equal to 0
Step 2 ---------- We multiply 0.250 by 2 and take the integer
part 0.250 x 2 = 0.5 Integer part = 0 Fractional part = 0.5 As,
fractional part is not equal to 0
Step 3 ---------- We multiply 0.5 by 2 and take the integer part
0.5 x 2 = 1 Integer part = 1 Fractional part = 0.0 As, fractional
part is equal to 0 so we stop here
Fractional decimal to Binary

Step 1 ---------- We multiply 0.125 by 2 and take the integer


part 0.125 x 2 = 0.250 Integer part = 0 Fractional part = 0.250
As, fractional part is not equal to 0
Step 2 ---------- We multiply 0.250 by 2 and take the integer
part 0.250 x 2 = 0.5 Integer part = 0 Fractional part = 0.5 As,
fractional part is not equal to 0
Step 3 ---------- We multiply 0.5 by 2 and take the integer part
0.5 x 2 = 1 Integer part = 1 Fractional part = 0.0 As, fractional
part is equal to 0 so we stop here

• 9.12510 = 1001.0012
Fractional decimal to Binary
Fractional decimal to Binary
The method of repeated multiplication by 2 has to be used to convert such kind of decimal fractions.

The steps involved in the method of repeated multiplication by 2:


Step 1: Multiply the decimal fraction by 2 and note the integer part. The integer part is either 0 or 1.

Step 2: Discard the integer part of the previous product. Multiply the fractional part of the previous
product by 2. Repeat Step 1 until the same fraction repeats or terminates (0).

Step 3: The resulting integer part forms a sequence of 0s and 1s that become the binary equivalent of
decimal fraction.

Step 4: The final answer is to be written from first integer part obtained till the last integer part obtained.

Write the intger parts from top to bottom to obtain the equivalent fractional
binary number. Hence (0.2)10=(0.00110011…)2 = (0.00110011)2
Fractional decimal to Binary

Write the intger parts from top to bottom to obtain the equivalent fractional
binary number. Hence (0.2)10=(0.00110011…)2 = (0.00110011)2
End

You might also like