SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Chapter 2
Data Representation
• Data Representation
• Compliments
• Subtraction of Unsigned Numbers
using r’s complement
• How To Represent Signed Numbers
• Floating-Point Representation
Data Types
• The data types stored in digital computers
may be classified as being one of the
following categories:
1. numbers used in arithmetic computations,
2. letters of the alphabet used in data
processing, and
3. other discrete symbols used for specific
purposes.
All types of data are represented in computers in
binary-coded form.
Binary Numbers
• Binary numbers are made of binary digits (bits):
0 and 1
• Convert the following to decimal
(1011)2 = 1x23 + 0x22 + 1x21 + 1x20 = (11)10
Example
• Use radix representation to convert the binary number
(101.01) into decimal.
• The position value is power of 2
• 1 0 1. 0 1
•
• 22 21 20 2-1 2-2
• 4 + 0 + 1 + 0 + 1/22 = 5.25
(101.01)2  (5.25)10
Converting an Integer from Decimal to Another
Base
• Divide the decimal number by the base (e.g.
• The remainder is the lowest-order digit
• Repeat the first two steps until no divisor
remains.
• For binary the even number has no remainder
‘0’, while the odd has ‘1’
For each digit position:
Converting an Integer from Decimal to
Another Base
Example
for (13)10:
Integer
Quotient
13/2 = (12+1)½ a0 = 1
6/2 = ( 6+0 )½ a1 = 0
3/2 = (2+1 )½ a2 = 1
1/2 = (0+1) ½ a3 = 1
Remainder Coefficient
Answer (13)10 = (a3 a2 a1 a0)2 = (1101)2
Converting a Fraction from Decimal
to Another Base
Example for
(0.625)10: Integer
0.625 x 2 = 1 + 0.25 a-1 = 1
0.250 x 2 = 0 + 0.50 a-2 = 0
0.500 x 2 = 1 + 0 a-3 = 1
Fraction Coefficient
Answer (0.625)10 = (0.a-1 a-2 a-3 )2 = (0.101)2
DECIMAL TO BINARY CONVERSION
(INTEGER+FRACTION)
(1) Separate the decimal number into integer and fraction parts.
(2) Repeatedly divide the integer part by 2 to give a quotient
and a remainder and
Remove the remainder. Arrange the sequence of remainders
right to left from the period. (Least significant bit first)
(3) Repeatedly multiply the fraction part by 2 to give an integer
and a fraction part
and remove the integer. Arrange the sequence of integers
left to right from the period. (Most significant fraction bit first)
(Example) (41.6875)10 (?)2
Integer = 41, Fraction = 0.6875
The first procedure produces
41= 1 x 25 + 0 x 24 + 1 x 23 + 0 x 22 + 0 x 2 + 1 = (101001)
0.6875=0.1011
41.6875 (10) = 101001.1011 (2)
Integer remainder
41 /2 1
20 0
10 0
5 1
2 0
1 1
Overflow Fraction
X by 2 .6875
1 .3750
0 .750
1 .5
1 0
Octal Numbers
• Octal numbers (Radix or base=8) are made of octal
digits: (0,1,2,3,4,5,6,7)
• How many items does an octal number represent?
• Convert the following octal number to decimal
(465.27)8 = 4x82 + 6x81 + 5x80 + 2x8-1 + 7x8-2
Converting an Integer from Decimal
to Octal
Example for (0.3125)10:
Integer
0.3125 x 8 = 2 + 0.5 a-1 = 2
0.5000 x 8 = 4 + 0 a-2 = 4
Fraction Coefficient
Answer (0.3125)10 = (0.24)8
Combine the two (175.3125)10 = (257.24)8
Remainder
of division
Overflow of
multiplication
Hexadecimal Numbers
• Hexadecimal numbers are made of 16 symbols:
o (0,1,2,3,4,5,6,7,8,9,A, B, C, D, E, F)
• Convert a hexadecimal number to decimal
o (3A9F)16 = 3x163 + 10x162 + 9x161 + 15x160 = 1499910
• Hexadecimal with fractions:
o (2D3.5)16 = 2x162 + 13x161 + 3x160 + 5x16-1 = 723.312510
• Note that each hexadecimal digit can be
represented with four bits.
o (1110) 2 = (E)16
• Groups of four bits are called a nibble.
o (1110) 2
Example
• Convert the decimal number
(107.00390625)10 into hexadecimal number.
• (107.00390625)10  (6B.01)16
Integer remainde
r
107 Divide/16
6 11=B
0 6
Overflow Fraction
X by 16 .
00390625
0 .0625
1 .0000
.
Closer to
the period
Conversion Between Number Bases
Decimal(base 10)
Octal(base 8)
Binary(base 2)
Hexadecimal
(base16)
° We normally convert to base 10
because we are naturally used to the
decimal number system.
° We can also convert to other number
systems
One to one comparison
• Binary, octal, and
hexadecimal similar
• Easy to build circuits to
operate on these
representations
• Possible to convert
between the three formats
Converting between Base 16 and
Base 2
° Conversion is easy!
 Determine 4-bit value for each hex digit
° Note that there are 24 = 16 different values of
four bits which means each 16 value is
converted to four binary bits.
° Easier to read and write in hexadecimal.
° Representations are equivalent!
3A9F16 = 0011 1010 1001 11112
3 A 9 F
Converting between Base 16 and
Base 8
1. Convert from Base 16 to Base 2
2. Regroup bits into groups of three starting from right
3. Ignore leading zeros
4. Each group of three bits forms an octal digit (8 is
represented by 3 binary bits).
352378 = 011 101 010 011 1112
5 2 3 73
3A9F16 = 0011 1010 1001 11112
3 A 9 F
Example
Convert 101011110110011 to
a. octal number
b. hexadecimal number
a. Each 3 bits are converted to octal :
(101) (011) (110) (110) (011)
5 3 6 6 3
101011110110011 = (53663)8
b. Each 4 bits are converted to hexadecimal:
(0101) (0111) (1011) (0011)
5 7 B 3
101011110110011 = (57B3)16
Conversion from binary to hexadecimal is similar except that the bits
divided into groups of four.
Compliments
Complements Of Numbers
Subtraction using
addition
• Conventional addition (using carry) is easily
• implemented in digital computers.
• However; subtraction by borrowing is
difficult and inefficient for digital computers.
• Much more efficient to implement
subtraction using ADDITION OF the
COMPLEMENTS of numbers.
Binary Addition
1 1 1 1 0 1
+ 1 0 1 1 1
---------------------
0
1
0
1
1
1111
1 1 00
carries
Example Add (11110)2 to
(10111)2
(111101)2 + (10111) 2 = (1010100)2
carry
Binary Subtraction
• We can also perform subtraction (with borrows).
• Example: subtract (10111) from (1001101)
1 10
0 10 10 0 0 10
1 0 0 1 1 0 1
- 1 0 1 1 1
------------------------
0 1 1 0 1 1 0
borrows
1+1=
2
(1001101)2 - (10111)2 = (0110110)2
The complement 1’s of
1011001 is 0100110
0 1 1 0 0- 1
1 1 1 1 1 1
1 0 0 1 1 0
0 0 1 1 1- 1
1 1 1 1 1 1
1 1 0 0 0 0
1
1
0
The 1’s complement of
0001111 is 1110000
0
1
1
l’s complement
For binary numbers, r = 2,
r’s complement is the 2’s complement.
The 2’s complement of N is 2n - N.
2’s complement
Digit
n
Digit
n-1
Next
digit
Next
digit
First
digit
0 0 0 0 0
-
1
2’s complement Example
The 2’s complement of
1011001 is 0100111
The 2’s complement of
0001111 is 1110001
0 1 1 0 0- 1
0 0 0 0 0 0
1 0 0 1 1 1
0 0 1 1 1- 1
1 1 0 0 0 1
1
0
0
0
1
1
0 0 0 0 0 001
Fast Methods for 2’s
Complement
Method 1:
The 2’s complement of binary number is obtained by adding 1 to the
l’s complement value.
Example:
1’s complement of 101100 is 010011 (invert the 0’s and 1’s)
2’s complement of 101100 is 010011 + 1 = 010100
Fast Methods for 2’s
Complement
Method 2:
The 2’s complement can be formed by leaving all least significant 0’s
and the first 1 unchanged, and then replacing l’s by 0’s and 0’s by l’s
in all other higher significant bits.
Example:
The 2’s complement of 1101100 is
0010100
Leave the two low-order 0’s and the first 1 unchanged, and then
replacing 1’s by 0’s and 0’s by 1’s in the four most significant bits.
Examples
o Finding the 2’s complement of (01100101)2
• Method 1 – Simply complement each bit and
then add 1 to the result.
(01100101)2
[N] = 2’s complement = 1’s complement (10011010)2
+1
=(10011011)2
• Method 2 – Starting with the least significant
bit, copy all the bits up to and including the
first 1 bit and then complement the remaining
bits.
N = 0 1 1 0 0 1 0 1
[N] = 1 0 0 1 1 0 1 1
Video Reference
• http://www.youtube.com/watch?v=SXAr35BiqK8

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

PPT ON NUMBER SYSTEM
PPT ON NUMBER SYSTEMPPT ON NUMBER SYSTEM
PPT ON NUMBER SYSTEM
 
Computer Number system
Computer Number systemComputer Number system
Computer Number system
 
Number system computer fundamental
 Number  system computer fundamental  Number  system computer fundamental
Number system computer fundamental
 
Number System
Number SystemNumber System
Number System
 
01.number systems
01.number systems01.number systems
01.number systems
 
Numbersystemcont
NumbersystemcontNumbersystemcont
Numbersystemcont
 
Number systems ppt
Number systems pptNumber systems ppt
Number systems ppt
 
Number System
Number SystemNumber System
Number System
 
Representation Of Numbers and Characters
Representation Of Numbers and CharactersRepresentation Of Numbers and Characters
Representation Of Numbers and Characters
 
Binary number systems
Binary number systemsBinary number systems
Binary number systems
 
Okkkkk
OkkkkkOkkkkk
Okkkkk
 
Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"
 
Sig figs.ppt
Sig figs.pptSig figs.ppt
Sig figs.ppt
 
Number system and their conversion
Number system and their conversionNumber system and their conversion
Number system and their conversion
 
Chapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbersChapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbers
 
01.number systems
01.number systems01.number systems
01.number systems
 
Bolum1cozumler
Bolum1cozumlerBolum1cozumler
Bolum1cozumler
 
Number system and codes
Number system and codesNumber system and codes
Number system and codes
 
Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes
 
Natural and Whole Numbers
Natural and Whole NumbersNatural and Whole Numbers
Natural and Whole Numbers
 

Andere mochten auch

Register transfer & microoperations moris mano ch 04
Register transfer & microoperations    moris mano ch 04Register transfer & microoperations    moris mano ch 04
Register transfer & microoperations moris mano ch 04thearticlenow
 
Statistical analysis training course
Statistical analysis training courseStatistical analysis training course
Statistical analysis training courseMarwa Abo-Amra
 
Register transfer language
Register  transfer languageRegister  transfer language
Register transfer languagehamza munir
 
Artificial Neural Network
Artificial Neural NetworkArtificial Neural Network
Artificial Neural NetworkManasa Mona
 
Neural Network Classification and its Applications in Insurance Industry
Neural Network Classification and its Applications in Insurance IndustryNeural Network Classification and its Applications in Insurance Industry
Neural Network Classification and its Applications in Insurance IndustryInderjeet Singh
 
Instruction cycle
Instruction cycleInstruction cycle
Instruction cycleKumar
 
Register transfer and micro-operation
Register transfer and micro-operationRegister transfer and micro-operation
Register transfer and micro-operationNikhil Pandit
 
Register transfer language
Register transfer languageRegister transfer language
Register transfer languageSanjeev Patel
 
Chapter 5 - Fuzzy Logic
Chapter 5 - Fuzzy LogicChapter 5 - Fuzzy Logic
Chapter 5 - Fuzzy LogicAshique Rasool
 
Artificial neural network
Artificial neural networkArtificial neural network
Artificial neural networkDEEPASHRI HK
 
Fuzzy Sets Introduction With Example
Fuzzy Sets Introduction With ExampleFuzzy Sets Introduction With Example
Fuzzy Sets Introduction With Exampleraisnasir
 

Andere mochten auch (15)

Register transfer & microoperations moris mano ch 04
Register transfer & microoperations    moris mano ch 04Register transfer & microoperations    moris mano ch 04
Register transfer & microoperations moris mano ch 04
 
Mc namer test of correlation
Mc namer test of correlationMc namer test of correlation
Mc namer test of correlation
 
Statistical analysis training course
Statistical analysis training courseStatistical analysis training course
Statistical analysis training course
 
Register transfer language
Register  transfer languageRegister  transfer language
Register transfer language
 
Artificial Neural Network
Artificial Neural NetworkArtificial Neural Network
Artificial Neural Network
 
Neural
NeuralNeural
Neural
 
Neural Network Classification and its Applications in Insurance Industry
Neural Network Classification and its Applications in Insurance IndustryNeural Network Classification and its Applications in Insurance Industry
Neural Network Classification and its Applications in Insurance Industry
 
Instruction cycle
Instruction cycleInstruction cycle
Instruction cycle
 
Register transfer and micro-operation
Register transfer and micro-operationRegister transfer and micro-operation
Register transfer and micro-operation
 
Register transfer language
Register transfer languageRegister transfer language
Register transfer language
 
Chapter 5 - Fuzzy Logic
Chapter 5 - Fuzzy LogicChapter 5 - Fuzzy Logic
Chapter 5 - Fuzzy Logic
 
Artificial neural network
Artificial neural networkArtificial neural network
Artificial neural network
 
Fuzzy logic ppt
Fuzzy logic pptFuzzy logic ppt
Fuzzy logic ppt
 
Instruction cycle
Instruction cycleInstruction cycle
Instruction cycle
 
Fuzzy Sets Introduction With Example
Fuzzy Sets Introduction With ExampleFuzzy Sets Introduction With Example
Fuzzy Sets Introduction With Example
 

Ähnlich wie Data representation

digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptxsulekhasaxena2
 
1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy
1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy
1. NUMBER SYSTEM.pptx Computer Applications in PharmacyVedika Narvekar
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptxamudhak10
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptxamudhak10
 
Ncp computer appls num sys2 pramod
Ncp computer appls  num sys2 pramodNcp computer appls  num sys2 pramod
Ncp computer appls num sys2 pramodNCP
 
Logic Design 2009
Logic Design 2009Logic Design 2009
Logic Design 2009lionking
 
Binary octal
Binary octalBinary octal
Binary octaldrdipo4
 
Logic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and CodesLogic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and CodesGouda Mando
 
Chapter 2 Data Representation on CPU (part 1)
Chapter 2 Data Representation on CPU (part 1)Chapter 2 Data Representation on CPU (part 1)
Chapter 2 Data Representation on CPU (part 1)Frankie Jones
 
Digital Logic Design.pptx
Digital Logic Design.pptxDigital Logic Design.pptx
Digital Logic Design.pptxAminaZahid16
 
Video lectures
Video lecturesVideo lectures
Video lecturesEdhole.com
 

Ähnlich wie Data representation (20)

digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptx
 
Number_Systems (2).ppt
Number_Systems (2).pptNumber_Systems (2).ppt
Number_Systems (2).ppt
 
1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy
1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy
1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
 
Ncp computer appls num sys2 pramod
Ncp computer appls  num sys2 pramodNcp computer appls  num sys2 pramod
Ncp computer appls num sys2 pramod
 
Logic Design 2009
Logic Design 2009Logic Design 2009
Logic Design 2009
 
digitalelectronics.ppt
digitalelectronics.pptdigitalelectronics.ppt
digitalelectronics.ppt
 
Binary octal
Binary octalBinary octal
Binary octal
 
Logic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and CodesLogic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and Codes
 
Unit 4.docx
Unit 4.docxUnit 4.docx
Unit 4.docx
 
Chapter 2 Data Representation on CPU (part 1)
Chapter 2 Data Representation on CPU (part 1)Chapter 2 Data Representation on CPU (part 1)
Chapter 2 Data Representation on CPU (part 1)
 
Alu1
Alu1Alu1
Alu1
 
Number system
Number systemNumber system
Number system
 
Digital Logic Design.pptx
Digital Logic Design.pptxDigital Logic Design.pptx
Digital Logic Design.pptx
 
Video lectures
Video lecturesVideo lectures
Video lectures
 
Mba ebooks
Mba ebooksMba ebooks
Mba ebooks
 
Number system
Number systemNumber system
Number system
 
DLD-Introduction.pptx
DLD-Introduction.pptxDLD-Introduction.pptx
DLD-Introduction.pptx
 
number system
number systemnumber system
number system
 

Kürzlich hochgeladen

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Kürzlich hochgeladen (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Data representation

  • 1. Chapter 2 Data Representation • Data Representation • Compliments • Subtraction of Unsigned Numbers using r’s complement • How To Represent Signed Numbers • Floating-Point Representation
  • 2. Data Types • The data types stored in digital computers may be classified as being one of the following categories: 1. numbers used in arithmetic computations, 2. letters of the alphabet used in data processing, and 3. other discrete symbols used for specific purposes. All types of data are represented in computers in binary-coded form.
  • 3. Binary Numbers • Binary numbers are made of binary digits (bits): 0 and 1 • Convert the following to decimal (1011)2 = 1x23 + 0x22 + 1x21 + 1x20 = (11)10
  • 4. Example • Use radix representation to convert the binary number (101.01) into decimal. • The position value is power of 2 • 1 0 1. 0 1 • • 22 21 20 2-1 2-2 • 4 + 0 + 1 + 0 + 1/22 = 5.25 (101.01)2  (5.25)10
  • 5. Converting an Integer from Decimal to Another Base • Divide the decimal number by the base (e.g. • The remainder is the lowest-order digit • Repeat the first two steps until no divisor remains. • For binary the even number has no remainder ‘0’, while the odd has ‘1’ For each digit position:
  • 6. Converting an Integer from Decimal to Another Base Example for (13)10: Integer Quotient 13/2 = (12+1)½ a0 = 1 6/2 = ( 6+0 )½ a1 = 0 3/2 = (2+1 )½ a2 = 1 1/2 = (0+1) ½ a3 = 1 Remainder Coefficient Answer (13)10 = (a3 a2 a1 a0)2 = (1101)2
  • 7. Converting a Fraction from Decimal to Another Base Example for (0.625)10: Integer 0.625 x 2 = 1 + 0.25 a-1 = 1 0.250 x 2 = 0 + 0.50 a-2 = 0 0.500 x 2 = 1 + 0 a-3 = 1 Fraction Coefficient Answer (0.625)10 = (0.a-1 a-2 a-3 )2 = (0.101)2
  • 8. DECIMAL TO BINARY CONVERSION (INTEGER+FRACTION) (1) Separate the decimal number into integer and fraction parts. (2) Repeatedly divide the integer part by 2 to give a quotient and a remainder and Remove the remainder. Arrange the sequence of remainders right to left from the period. (Least significant bit first) (3) Repeatedly multiply the fraction part by 2 to give an integer and a fraction part and remove the integer. Arrange the sequence of integers left to right from the period. (Most significant fraction bit first)
  • 9. (Example) (41.6875)10 (?)2 Integer = 41, Fraction = 0.6875 The first procedure produces 41= 1 x 25 + 0 x 24 + 1 x 23 + 0 x 22 + 0 x 2 + 1 = (101001) 0.6875=0.1011 41.6875 (10) = 101001.1011 (2) Integer remainder 41 /2 1 20 0 10 0 5 1 2 0 1 1 Overflow Fraction X by 2 .6875 1 .3750 0 .750 1 .5 1 0
  • 10. Octal Numbers • Octal numbers (Radix or base=8) are made of octal digits: (0,1,2,3,4,5,6,7) • How many items does an octal number represent? • Convert the following octal number to decimal (465.27)8 = 4x82 + 6x81 + 5x80 + 2x8-1 + 7x8-2
  • 11. Converting an Integer from Decimal to Octal Example for (0.3125)10: Integer 0.3125 x 8 = 2 + 0.5 a-1 = 2 0.5000 x 8 = 4 + 0 a-2 = 4 Fraction Coefficient Answer (0.3125)10 = (0.24)8 Combine the two (175.3125)10 = (257.24)8 Remainder of division Overflow of multiplication
  • 12. Hexadecimal Numbers • Hexadecimal numbers are made of 16 symbols: o (0,1,2,3,4,5,6,7,8,9,A, B, C, D, E, F) • Convert a hexadecimal number to decimal o (3A9F)16 = 3x163 + 10x162 + 9x161 + 15x160 = 1499910 • Hexadecimal with fractions: o (2D3.5)16 = 2x162 + 13x161 + 3x160 + 5x16-1 = 723.312510 • Note that each hexadecimal digit can be represented with four bits. o (1110) 2 = (E)16 • Groups of four bits are called a nibble. o (1110) 2
  • 13. Example • Convert the decimal number (107.00390625)10 into hexadecimal number. • (107.00390625)10  (6B.01)16 Integer remainde r 107 Divide/16 6 11=B 0 6 Overflow Fraction X by 16 . 00390625 0 .0625 1 .0000 . Closer to the period
  • 14. Conversion Between Number Bases Decimal(base 10) Octal(base 8) Binary(base 2) Hexadecimal (base16) ° We normally convert to base 10 because we are naturally used to the decimal number system. ° We can also convert to other number systems
  • 15. One to one comparison • Binary, octal, and hexadecimal similar • Easy to build circuits to operate on these representations • Possible to convert between the three formats
  • 16. Converting between Base 16 and Base 2 ° Conversion is easy!  Determine 4-bit value for each hex digit ° Note that there are 24 = 16 different values of four bits which means each 16 value is converted to four binary bits. ° Easier to read and write in hexadecimal. ° Representations are equivalent! 3A9F16 = 0011 1010 1001 11112 3 A 9 F
  • 17. Converting between Base 16 and Base 8 1. Convert from Base 16 to Base 2 2. Regroup bits into groups of three starting from right 3. Ignore leading zeros 4. Each group of three bits forms an octal digit (8 is represented by 3 binary bits). 352378 = 011 101 010 011 1112 5 2 3 73 3A9F16 = 0011 1010 1001 11112 3 A 9 F
  • 18. Example Convert 101011110110011 to a. octal number b. hexadecimal number a. Each 3 bits are converted to octal : (101) (011) (110) (110) (011) 5 3 6 6 3 101011110110011 = (53663)8 b. Each 4 bits are converted to hexadecimal: (0101) (0111) (1011) (0011) 5 7 B 3 101011110110011 = (57B3)16 Conversion from binary to hexadecimal is similar except that the bits divided into groups of four.
  • 20. Subtraction using addition • Conventional addition (using carry) is easily • implemented in digital computers. • However; subtraction by borrowing is difficult and inefficient for digital computers. • Much more efficient to implement subtraction using ADDITION OF the COMPLEMENTS of numbers.
  • 21. Binary Addition 1 1 1 1 0 1 + 1 0 1 1 1 --------------------- 0 1 0 1 1 1111 1 1 00 carries Example Add (11110)2 to (10111)2 (111101)2 + (10111) 2 = (1010100)2 carry
  • 22. Binary Subtraction • We can also perform subtraction (with borrows). • Example: subtract (10111) from (1001101) 1 10 0 10 10 0 0 10 1 0 0 1 1 0 1 - 1 0 1 1 1 ------------------------ 0 1 1 0 1 1 0 borrows 1+1= 2 (1001101)2 - (10111)2 = (0110110)2
  • 23. The complement 1’s of 1011001 is 0100110 0 1 1 0 0- 1 1 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 1- 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 0 The 1’s complement of 0001111 is 1110000 0 1 1 l’s complement
  • 24. For binary numbers, r = 2, r’s complement is the 2’s complement. The 2’s complement of N is 2n - N. 2’s complement Digit n Digit n-1 Next digit Next digit First digit 0 0 0 0 0 - 1
  • 25. 2’s complement Example The 2’s complement of 1011001 is 0100111 The 2’s complement of 0001111 is 1110001 0 1 1 0 0- 1 0 0 0 0 0 0 1 0 0 1 1 1 0 0 1 1 1- 1 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 001
  • 26. Fast Methods for 2’s Complement Method 1: The 2’s complement of binary number is obtained by adding 1 to the l’s complement value. Example: 1’s complement of 101100 is 010011 (invert the 0’s and 1’s) 2’s complement of 101100 is 010011 + 1 = 010100
  • 27. Fast Methods for 2’s Complement Method 2: The 2’s complement can be formed by leaving all least significant 0’s and the first 1 unchanged, and then replacing l’s by 0’s and 0’s by l’s in all other higher significant bits. Example: The 2’s complement of 1101100 is 0010100 Leave the two low-order 0’s and the first 1 unchanged, and then replacing 1’s by 0’s and 0’s by 1’s in the four most significant bits.
  • 28. Examples o Finding the 2’s complement of (01100101)2 • Method 1 – Simply complement each bit and then add 1 to the result. (01100101)2 [N] = 2’s complement = 1’s complement (10011010)2 +1 =(10011011)2 • Method 2 – Starting with the least significant bit, copy all the bits up to and including the first 1 bit and then complement the remaining bits. N = 0 1 1 0 0 1 0 1 [N] = 1 0 0 1 1 0 1 1