SlideShare a Scribd company logo
Chapter Two
Data Representation
1
Data types
• Registers contain either data or control information
 Control information is a bit or group of bits used to specify the sequence of
command signals needed for data manipulation
 Data are numbers and other binary-coded information that are operated on
• Possible data types in registers:
Numbers used in computations
 Letters of the alphabet used in data processing
 Other discrete symbols used for specific purposes
2
 All types of data, except binary numbers, are represented in binary-coded
form
 A number system of base, or radix, r is a system that uses distinct symbols
for r digits
 Numbers are represented by a string of digit symbols
 The string of digits 724.5 represents the quantity
3
Cont.…
 There are four types of numbering system. Those are:
Decimal: base 10
Binary: base 2
Octal: base 8
Hexadecimal: base 16
4
Decimal Binary Octal Hexadecimal
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
5
Cont.…
 The string of digits 101101 in the binary number system represents the
quantity
 We will also use the octal (radix 8) and hexadecimal (radix 16) number
systems
6
Conversion from decimal to radix r system
 Conversion from decimal to radix r system is carried out by separating the
number into its integer and fraction parts and converting each part separately
 Divide the integer successively by r and accumulate the remainders from
bottom to top
 Multiply the fraction successively by r until the fraction becomes zero and
accumulate the integers from top to bottom.
 Example convert 41.6875 to binary.
7
Cont.…
8
Example: decimal number 32 converting to base r.
 32/2=16 r 0
 16/2=8 r 0
 8/2=4 r 0
 4/2=2 r 0
 2/2=1 r 0
 ½=0 r 1
 32=(1000000)2
 32/8=4 r 0
 4/8=0 r 4
 32=(40)8
 32/16=2 r 0
 2/16=0 r 2
 32=(20)16
9
Conversion from radix r(2,8,16) to decimal system
o Exercise
o (100000)2=?
o (40)8=?
o (20)16=?
o Binary (101101)2 = 1 x 25
+ 0 x 24
+ 1 x 23
+ 1 x 22
+ 0 x 21
+ 1 x 20
=
(45 )10
o Octal (736.4)8 = 7 x 82
+ 3 x 81
+ 6 x 80
+ 4 x 8-1 =
(478.5)10
o Hexadecimal (F3)16 = F x 161
+ 3 x 160
= (243)10
10
Convert from binary numbing system to octal and
hexadecimal
 Each octal digit corresponds to three binary digits
 Each hexadecimal digit corresponds to four binary digits
 Rather than specifying numbers in binary form, refer to them in octal or
hexadecimal and reduce the number of digits by 1/3 or ¼, respectively.
11
Converting from octal and hexadecimal to binary
 Octal to Binary
• Step 1 − Convert each octal digit to a 3 digit binary number (the octal
digits may be treated as decimal for this conversion).
• Step 2 − Combine all the resulting binary groups (of 3 digits each) into a
single binary number.
 Hexadecimal to Binary
• Step 1 − Convert each hexadecimal digit to a 4 digit binary number (the
hexadecimal digits may be treated as decimal for this conversion).
• Step 2 − Combine all the resulting binary groups (of 4 digits each) into a
single binary number.
12
Example
(1010111101100011)2
 To octal
 001 010 111 101 100 011
1 2 7 5 4 3
(127543)8
 To hexadecimal
 1010 1111 0110 0011
A F 6 3
(AF63)16
13
Converting octal to hexadecimal and vice versa
To convert octal to hexadecimal
We convert each octal to 3 digit bit binary number means that convert to
binary number then we can convert it to corresponding hexadecimal by
grouping 4 digits of binary number
(63)8
110 011
110011
0011 0011
3 3
(33)16
14
Complements
• Complements are used in digital computers for simplifying subtraction and
logical manipulation
• Two types of complements for each base r system:
or’s complement and
o(r – 1)’s complement
• Given a number N in base r having n digits, the (r – 1)’s complement of N is
defined as
(rn
– 1) – N
• For decimal, the 9’s complement of N is (10n
– 1) – N
15
Example
• The 9’s complement of 546700 is 999999 – 546700 = 453299
• The 9’s complement of 453299 is 999999 – 453299 = 546700
• For binary, the 1’s complement of N is (2n
– 1) – N
• The 1’s complement of 1011001 is 1111111 – 1011001 = 0100110
The 1’s complement is the true complement of the number just toggle all bits.
16
Cont.…
• The r’s complement of an n-digit number N in base r is defined as rn
–
N
• This is the same as adding 1 to the (r – 1)’s complement
The 10’s complement of 2389 is 7610 + 1 =
7611
The 2’s complement of 101100 is 010011 + 1 =
010100
17
Fixed-Point Representation
• Positive integers and zero can be represented by unsigned
numbers
• Negative numbers must be represented by signed numbers
since + and – signs are not available, only 1’s and 0’s is.
• Signed numbers have msb as 0 for positive and 1 for
negative – msb is the sign bit
• Two ways to designate binary point position in a register
Fixed point position
Floating-point representation
18
Cont.…
• Fixed point position usually uses one of the two
following positions
 A binary point in the extreme left of the register to make
it a fraction
 A binary point in the extreme right of the register to
make it an integer
 In both cases, a binary point is not actually present
19
Cont.…
• The floating-point representations use a second register to
designate the position of the binary point in the first register
When an integer is positive, the msb, or sign bit, is 0 and the
remaining bits represent the magnitude
• When an integer is negative, the msb, or sign bit, is 1, but the
rest of the number can be represented in one of three ways
Signed-magnitude representation
 Signed-1’s complement representation
Signed-2’s complement representation
20
Example
• Consider an 8-bit register and the number +14
• The only way to represent it is 00001110
• Consider an 8-bit register and the number –14
o Signed magnitude: 1 0001110
o Signed 1’s complement: 1 1110001
 Signed 2’s complement: 1 1110010
21
Thank you!
22

More Related Content

PDF
Module 2_Data representations.pdf
PDF
CS304PC:Computer Organization and Architecture Unit- III PDF notes .pdf
PPTX
Lecture 1
PPT
Number_Systems decimal, binary, octal, and hexadecimal
PPT
An introduction to the different number systems
PPT
Number Systems and its effectiveness .ppt
PPT
Number_Systems_Number base conversions.ppt
PPT
Number_Systems _binary_octal_hex_dec.ppt
Module 2_Data representations.pdf
CS304PC:Computer Organization and Architecture Unit- III PDF notes .pdf
Lecture 1
Number_Systems decimal, binary, octal, and hexadecimal
An introduction to the different number systems
Number Systems and its effectiveness .ppt
Number_Systems_Number base conversions.ppt
Number_Systems _binary_octal_hex_dec.ppt

Similar to Chapter 2 Data Representation Data Representation (20)

PDF
Finite word length effects
PPT
Number_Systems (2).ppt
PPTX
PPT
Chapter 2 Data Representation.pptChapter 2 Data Representation.ppt
PPT
Data representation
PDF
Digital Logic Computer Design lecture notes
PPTX
Chapter 2.1 introduction to number system
PPT
DLD_Lecture_notes2.ppt
PPT
Basic Digital_Systems_and_Binary_Numbers Sample.ppt
PPT
Data representation
PPTX
Number system computer fundamental
PPT
Data Representation Data Representation1
PPT
BEEE - Part B - Unit 3 PPT.ppt DL&CO - Unit 1 PPT.ppt
PPTX
Data Representation
PDF
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
PPTX
Data Representation
PPT
LCDF3_Chap_01 computer engineering 01.ppt
PPT
Lecture 2 ns
PPT
DL&CO - Unit 1 PPT.ppt DL&CO - Unit 1 PPT.ppt DL&CO - Unit 1 PPT.ppt
Finite word length effects
Number_Systems (2).ppt
Chapter 2 Data Representation.pptChapter 2 Data Representation.ppt
Data representation
Digital Logic Computer Design lecture notes
Chapter 2.1 introduction to number system
DLD_Lecture_notes2.ppt
Basic Digital_Systems_and_Binary_Numbers Sample.ppt
Data representation
Number system computer fundamental
Data Representation Data Representation1
BEEE - Part B - Unit 3 PPT.ppt DL&CO - Unit 1 PPT.ppt
Data Representation
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
Data Representation
LCDF3_Chap_01 computer engineering 01.ppt
Lecture 2 ns
DL&CO - Unit 1 PPT.ppt DL&CO - Unit 1 PPT.ppt DL&CO - Unit 1 PPT.ppt
Ad

Recently uploaded (20)

PDF
cuic standard and advanced reporting.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Cloud computing and distributed systems.
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Electronic commerce courselecture one. Pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation theory and applications.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Machine learning based COVID-19 study performance prediction
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
cuic standard and advanced reporting.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Cloud computing and distributed systems.
Encapsulation_ Review paper, used for researhc scholars
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Review of recent advances in non-invasive hemoglobin estimation
Electronic commerce courselecture one. Pdf
Spectral efficient network and resource selection model in 5G networks
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation theory and applications.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Machine learning based COVID-19 study performance prediction
20250228 LYD VKU AI Blended-Learning.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Approach and Philosophy of On baking technology
Building Integrated photovoltaic BIPV_UPV.pdf
Ad

Chapter 2 Data Representation Data Representation

  • 2. Data types • Registers contain either data or control information  Control information is a bit or group of bits used to specify the sequence of command signals needed for data manipulation  Data are numbers and other binary-coded information that are operated on • Possible data types in registers: Numbers used in computations  Letters of the alphabet used in data processing  Other discrete symbols used for specific purposes 2
  • 3.  All types of data, except binary numbers, are represented in binary-coded form  A number system of base, or radix, r is a system that uses distinct symbols for r digits  Numbers are represented by a string of digit symbols  The string of digits 724.5 represents the quantity 3
  • 4. Cont.…  There are four types of numbering system. Those are: Decimal: base 10 Binary: base 2 Octal: base 8 Hexadecimal: base 16 4
  • 5. Decimal Binary Octal Hexadecimal 0 0000 0 0 1 0001 1 1 2 0010 2 2 3 0011 3 3 4 0100 4 4 5 0101 5 5 6 0110 6 6 7 0111 7 7 8 1000 10 8 9 1001 11 9 10 1010 12 A 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F 5
  • 6. Cont.…  The string of digits 101101 in the binary number system represents the quantity  We will also use the octal (radix 8) and hexadecimal (radix 16) number systems 6
  • 7. Conversion from decimal to radix r system  Conversion from decimal to radix r system is carried out by separating the number into its integer and fraction parts and converting each part separately  Divide the integer successively by r and accumulate the remainders from bottom to top  Multiply the fraction successively by r until the fraction becomes zero and accumulate the integers from top to bottom.  Example convert 41.6875 to binary. 7
  • 9. Example: decimal number 32 converting to base r.  32/2=16 r 0  16/2=8 r 0  8/2=4 r 0  4/2=2 r 0  2/2=1 r 0  ½=0 r 1  32=(1000000)2  32/8=4 r 0  4/8=0 r 4  32=(40)8  32/16=2 r 0  2/16=0 r 2  32=(20)16 9
  • 10. Conversion from radix r(2,8,16) to decimal system o Exercise o (100000)2=? o (40)8=? o (20)16=? o Binary (101101)2 = 1 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20 = (45 )10 o Octal (736.4)8 = 7 x 82 + 3 x 81 + 6 x 80 + 4 x 8-1 = (478.5)10 o Hexadecimal (F3)16 = F x 161 + 3 x 160 = (243)10 10
  • 11. Convert from binary numbing system to octal and hexadecimal  Each octal digit corresponds to three binary digits  Each hexadecimal digit corresponds to four binary digits  Rather than specifying numbers in binary form, refer to them in octal or hexadecimal and reduce the number of digits by 1/3 or ¼, respectively. 11
  • 12. Converting from octal and hexadecimal to binary  Octal to Binary • Step 1 − Convert each octal digit to a 3 digit binary number (the octal digits may be treated as decimal for this conversion). • Step 2 − Combine all the resulting binary groups (of 3 digits each) into a single binary number.  Hexadecimal to Binary • Step 1 − Convert each hexadecimal digit to a 4 digit binary number (the hexadecimal digits may be treated as decimal for this conversion). • Step 2 − Combine all the resulting binary groups (of 4 digits each) into a single binary number. 12
  • 13. Example (1010111101100011)2  To octal  001 010 111 101 100 011 1 2 7 5 4 3 (127543)8  To hexadecimal  1010 1111 0110 0011 A F 6 3 (AF63)16 13
  • 14. Converting octal to hexadecimal and vice versa To convert octal to hexadecimal We convert each octal to 3 digit bit binary number means that convert to binary number then we can convert it to corresponding hexadecimal by grouping 4 digits of binary number (63)8 110 011 110011 0011 0011 3 3 (33)16 14
  • 15. Complements • Complements are used in digital computers for simplifying subtraction and logical manipulation • Two types of complements for each base r system: or’s complement and o(r – 1)’s complement • Given a number N in base r having n digits, the (r – 1)’s complement of N is defined as (rn – 1) – N • For decimal, the 9’s complement of N is (10n – 1) – N 15
  • 16. Example • The 9’s complement of 546700 is 999999 – 546700 = 453299 • The 9’s complement of 453299 is 999999 – 453299 = 546700 • For binary, the 1’s complement of N is (2n – 1) – N • The 1’s complement of 1011001 is 1111111 – 1011001 = 0100110 The 1’s complement is the true complement of the number just toggle all bits. 16
  • 17. Cont.… • The r’s complement of an n-digit number N in base r is defined as rn – N • This is the same as adding 1 to the (r – 1)’s complement The 10’s complement of 2389 is 7610 + 1 = 7611 The 2’s complement of 101100 is 010011 + 1 = 010100 17
  • 18. Fixed-Point Representation • Positive integers and zero can be represented by unsigned numbers • Negative numbers must be represented by signed numbers since + and – signs are not available, only 1’s and 0’s is. • Signed numbers have msb as 0 for positive and 1 for negative – msb is the sign bit • Two ways to designate binary point position in a register Fixed point position Floating-point representation 18
  • 19. Cont.… • Fixed point position usually uses one of the two following positions  A binary point in the extreme left of the register to make it a fraction  A binary point in the extreme right of the register to make it an integer  In both cases, a binary point is not actually present 19
  • 20. Cont.… • The floating-point representations use a second register to designate the position of the binary point in the first register When an integer is positive, the msb, or sign bit, is 0 and the remaining bits represent the magnitude • When an integer is negative, the msb, or sign bit, is 1, but the rest of the number can be represented in one of three ways Signed-magnitude representation  Signed-1’s complement representation Signed-2’s complement representation 20
  • 21. Example • Consider an 8-bit register and the number +14 • The only way to represent it is 00001110 • Consider an 8-bit register and the number –14 o Signed magnitude: 1 0001110 o Signed 1’s complement: 1 1110001  Signed 2’s complement: 1 1110010 21