Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
8 views

Lecture 2-3, Number System

Uploaded by

Iqra Waheed
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Lecture 2-3, Number System

Uploaded by

Iqra Waheed
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 56

Number Systems

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

To depict a number in the Decimal Number


System, we attach a subscript 10 to x,
written x10.
Representation of values with Decimal
Number System
Representation of values with Decimal Number System

• Lets take 2125


• Breakdown the number 2125 as a sum of the ones,
tens, hundreds, thousands, and so on. Thus, we can
write 2125 as a sum of 2000, 100, 20 and 5
(2000+100+20+5=2125)
• Break down each of these numbers as a product of
an exponential multiple of 10 and a number
between 0-9.
• (2000 = 2 x 1000, 100 = 1 x 100, 20 = 2 x 10, 5 = 5 x
1)
Representation of values with Decimal
Number System
• Represent these values in the base-10 number
system.
• 2000 = 2 x 103, 100 = 1 x 102, 20 = 2 x 101 and 5
= 5 x 100
• Thus, the decimal representation of the given
number is (2125)10.
Number systems: Base 10 (Decimal)

• 10 digits = {0,1,2,3,4,5,6,7,8,9}

• example: 4537.8 = (4537.8) 10

4 5 3 7 . 8
3 2 1 0 -1
x 10 x 10 x 10 x 10 x 10

4000 + 500 + 40 + 7 + .8 = 4537.8


Binary Number System
Bits and Bytes
• Bit is smallest unit of data
• Binary digits(0,1) are called as bits.
• Nibble is 4 bits (use them in BCD and Hexa we
require 4 bits to represent them)
• 1 Byte = 8 bits
• 1 Word = 16 Bits
Binary Number System

Binary to decimal conversion


(10101)2 = (21)10
Step by step solution
Step 1: Write down the binary number:
10101
Step 2: Multiply each digit of the binary number by the corresponding power of two:
1x24 + 0x23 + 1x22 + 0x21 + 1x20
Step 3: Solve the powers:
1x16 + 0x8 + 1x4 + 0x2 + 1x1 = 16 + 0 + 4 + 0 + 1
Step 4: Add up the numbers written above:
16 + 0 + 4 + 0 + 1 = 21. This is the decimal equivalent of the binary number 10101.
Binary to
Decimal Conversion
• 1. Sum-of-Weights Method
• (1001100)2 = (76)10
• Step by step solution
• Step 1: Write down the binary number:
• 1001100
• Step 2: Multiply each digit of the binary number by the corresponding
power of two:
• 1x26 + 0x25 + 0x24 + 1x23 + 1x22 + 0x21 + 0x20
• Step 3: Solve the powers:
• 1x64 + 0x32 + 0x16 + 1x8 + 1x4 + 0x2 + 0x1 = 64 + 0 + 0 + 8 + 4 + 0 + 0
• Step 4: Add up the numbers written above:
• 64 + 0 + 0 + 8 + 4 + 0 + 0 = 76. This is the decimal equivalent of the binary
number 1001100.
Number systems: Base 2 (Binary)

• 2 digits = {0,1}

• example: 1011.1 = (1011.1) 2

1 0 1 1 . 1
3 2 1 0 -1
x 2 x 2 x 2 x 2x 2

8 + 0 + 2 + 1 + .5 = (11.5) 10
Decimal Conversion

2. Sum-of-non-zero terms
A quicker method is to add the weights of non-
zero terms.
100112 =24 + 21 + 20
=16 + 2 + 1 = 19
1011.1012 =23 + 21 + 20 + 2-1 +2-3
= 8 + 2 + 1 + ½ + 1/8 = 11 + 5/8
= 11.625
Least significant Bit(LSB) and Most
significant Bit (MSB)
Decimal to Binary Conversion
• Two Methods
• Repeated Division-by-2
• Sum-of-non-zero terms
Decimal to Binary Conversion using
Repeated Division-by-2
Steps to Convert from Decimal to Binary
Write down the decimal number.
Divide the number by 2.
Write the result underneath.
Write the remainder on the right hand
side. ...
Divide the result of the division by 2 and
again write down the remainder.
Repeat the steps until you will have the
last number either 0 or 1.
Decimal to Binary Conversion Example
Examples: Decimal to Binary Conversions

Solve Yourself
(225)10 = (?)2
The Power of 2

211 = 210 * 21 = 2K
212 = 210 * 22 = 4K

4K = 22 * 210 = 212 = 4096


16M = 24 * 220 = 224 = 16777216
Sum-of-non-zero terms
• The Sum-of-non-zero terms method is a
quicker method to determine decimal
equivalents of binary numbers without
resorting to writing an expression.
• In the Sum-of-nonzero terms method the
weights of non-zero binary bits are summed,
as the weights of zero binary bits do not
contribute towards the final sum representing
the decimal equivalent.
Decimal to Binary Conversion by ( Sum-of-non-
zero ) terms or subtracting powers of two from the decimal
number.
Example: (625)10 = ( ? )2
Example: (3846)10 = ( ? ) 2

Answer is (11110000110)
Example
Solve Yourself

• (2891)10 = ( ? ) 2
Decimal (Fraction) to Binary Conversion
Decimal (Fraction) to Binary
Conversion
Decimal (Fraction) to Binary Conversion

• Solve Yourself
• (225.225)10 = (?)2
Octal Number System
Decimal to Octal Conversion
Decimal to Octal Conversion
Using Repeated division by 8 Method
Decimal to Octal Conversion
Decimal (fraction) to Octal Conversion
Decimal (fraction) to Octal Conversion
Octal to Decimal Conversions
Octal to Decimal Conversions
Octal to Decimal Conversions

Solve Yourself
Binary to Octal/Octal to Binary
Conversion
Octal to Binary Conversion
Binary to Octal Conversion
Hexadecimal Number System
• The Hexadecimal number system is a base 16
number system and therefore has 16 digits and is
used primarily to represent binary strings in a
compact manner.
• Hexadecimal number system is not used by a
Digital System. The Hexadecimal number system is
for our convenience to long binary strings in a
short and concise form.
• Each Hexadecimal Number digit can represent a 4-
bit Binary Number.
Hexadecimal (or hex) is often used for addressing
Hexadecimal Number System
Decimal to Hexadecimal Conversion
Decimal to Hexadecimal Conversion
Decimal (Fraction)to Hexadecimal Conversion
Hexadecimal to Decimal Conversion
Hexadecimal to Decimal Conversion Using
Sum of Weights Method
Hexadecimal to Binary Conversion
Binary to Hexadecimal Conversion
Binary to Hexadecimal Conversion
Binary to hexa Conversion
2nd Method: convert From Hexadecimal to Decimal number
and from decimal to Octal Number
Octal to Hexadecimal Conversion 1st
Method
Octal to Hexadecimal Conversion

• 2nd Method: convert from Octal to Decimal


number and from decimal to Hexadecimal
Number
• Example (623)8 = ( ? )16
(623)8 = 6x82 + 2x81 + 3x80
= (403)10

You might also like