SlideShare a Scribd company logo
2
Figure.3.1 Typical Internal data representation types
Before we go into the details, let us take an example of interpretation. Say a byte in Memory has value "0011 0001". Although there exists a
possibility of so many interpretations as in figure 3.2, the program has only one interpretation as decided by the programmer and declared in the
program.
Figure.3.2 Data Interpretation
Fixed point numbers are also known as whole numbers or Integers. The number of bits used in representing the integer also implies the maximum
number that can be represented in the system hardware. However for the efficiency of storage and operations, one may choose to represent the
integer with one Byte, two Bytes, Four bytes or more. This space allocation is translated from the definition used by the programmer while defining a
variable as integer short or long and the Instruction Set Architecture.
In addition to the bit length definition for integers, we also have a choice to represent them as below:
Unsigned Integer: A positive number including zero can be represented in this format. All the allotted bits are utilised in defining the number.
So if one is using 8 bits to represent the unsigned integer, the range of values that can be represented is 28 i.e. "0" to "255". If 16 bits are used
for representing then the range is 216 i.e. "0 to 65535".
Signed Integer: In this format negative numbers, zero, and positive numbers can be represented. A sign bit indicates the magnitude direction
as positive or negative. There are three possible representations for signed integer and these are Sign Magnitude format, 1's Compliment
format and 2's Complement format.
Signed Integer – Sign Magnitude format: Most Significant Bit (MSB) is reserved for indicating the direction of the magnitude (value). A "0" on MSB
means a positive number and a "1" on MSB means a negative number. If n bits are used for representation, n-1 bits indicate the absolute value of
the number. Examples for n=8:
Most read
3
Examples for n=8:
0010 1111 = + 47 Decimal (Positive number)
1010 1111 = - 47 Decimal (Negative Number)
0111 1110 = +126 (Positive number)
1111 1110 = -126 (Negative Number)
0000 0000 = + 0 (Postive Number)
1000 0000 = - 0 (Negative Number)
Although this method is easy to understand, Sign Magnitude representation has several shortcomings like
Zero can be represented in two ways causing redundancy and confusion.
The total range for magnitude representation is limited to 2n-1, although n bits were accounted.
The separate sign bit makes the addition and subtraction more complicated. Also, comparing two numbers is not straightforward.
Signed Integer – 1’s Complement format: In this format too, MSB is reserved as the sign bit. But the difference is in representing the Magnitude part
of the value for negative numbers (magnitude) is inversed and hence called 1’s Complement form. The positive numbers are represented as it is in
binary. Let us see some examples to better our understanding.
Examples for n=8:
0010 1111 = + 47 Decimal (Positive number)
1101 0000 = - 47 Decimal (Negative Number)
0111 1110 = +126 (Positive number)
1000 0001 = -126 (Negative Number)
0000 0000 = + 0 (Postive Number)
1111 1111 = - 0 (Negative Number)
Step 1. -x = x' + 1 where x' is the one's complement of x.
Step 2 Extend the data width of the number, fill up with sign extension i.e. MSB bit is used to fill the bits.
Example: -47 decimal over 8bit representation
As you can see zero is not getting represented with redundancy. There is only one way of representing zero. The other problem of the complexity of
the arithmetic operation is also eliminated in 2’s complement representation. Subtraction is done as Addition.
More exercises on number conversion are left to the self-interest of readers.
The maximum number at best represented as a whole number is 2 . In the Scientific world, we do come across numbers like Mass of an Electron is
9.10939 x 10-31 Kg. Velocity of light is 2.99792458 x 108 m/s. Imagine to write the number in a piece of paper without exponent and converting into
binary for computer representation. Sure you are tired!!. It makes no sense to write a number in non- readable form or non- processible form. Hence
we write such large or small numbers using exponent and mantissa. This is said to be Floating Point representation or real number representation.
n
Most read
4
he real number system could have infinite values between 0 and 1.
Representation in computer
Unlike the two's complement representation for integer numbers, Floating Point number uses Sign and Magnitude representation for both mantissa
and exponent. In the number 9.10939 x 1031, in decimal form, +31 is Exponent, 9.10939 is known as Fraction. Mantissa, Significand and fraction are
synonymously used terms. In the computer, the representation is binary and the binary point is not fixed. For example, a number, say, 23.345 can be
written as 2.3345 x 101 or 0.23345 x 102 or 2334.5 x 10-2. The representation 2.3345 x 101 is said to be in normalised form.
Floating-point numbers usually use multiple words in memory as we need to allot a sign bit, few bits for exponent and many bits for mantissa. There
are standards for such allocation which we will see sooner.
We have two standards known as Single Precision and Double Precision from IEEE. These standards enable portability among different computers.
Figure 3.3 picturizes Single precision while figure 3.4 picturizes double precision. Single Precision uses 32bit format while double precision is 64 bits
word length. As the name suggests double precision can represent fractions with larger accuracy. In both the cases, MSB is sign bit for the mantissa
part, followed by Exponent and Mantissa. The exponent part has its sign bit.
Figure.3.3 IEEE 754 Single Precision Floating Point representation Standard
It is to be noted that in Single Precision, we can represent an exponent in the range -127 to +127. It is possible as a result of arithmetic operations
the resulting exponent may not fit in. This situation is called overflow in the case of positive exponent and underflow in the case of negative
exponent. The Double Precision format has 11 bits for exponent meaning a number as large as -1023 to 1023 can be represented. The programmer
has to make a choice between Single Precision and Double Precision declaration using his knowledge about the data being handled.
Figure 3.4 IEEE 754 Double Precision Floating Point representation Standard
The Floating Point operations on the regular CPU is very very slow. Generally, a special purpose CPU known as Co-processor is used. This Co-
processor works in tandem with the main CPU. The programmer should be using the float declaration only if his data is in real number form. Float
declaration is not to be used generously.
Decimal numbers (radix 10) are represented and processed in the system with the support of additional hardware. We deal with numbers in decimal
format in everyday life. Some machines implement decimal arithmetic too, like floating-point arithmetic hardware. In such a case, the CPU uses
decimal numbers in BCD (binary coded decimal) form and does BCD arithmetic operation. BCD operates on radix 10. This hardware operates without
conversion to pure binary. It uses a nibble to represent a number in packed BCD form. BCD operations require not only special hardware but also
decimal instruction set.
All of us know that when we do arithmetic operations, we get answers which have more digits than the operands (Ex: 8 x 2= 16). This happens in
computer arithmetic operations too. When the result size exceeds the allotted size of the variable or the register, it becomes an error and exception.
The exception conditions associated with numbers and number operations are Overflow, Underflow, Truncation, Rounding and Multiple Precision.
[ Credits : https://witscad.com/course/computer-architecture/chapter/data-representation ]
[ Copyright : Witspry @ 2020 ]
Most read
TOC
[ Credits : https://witscad.com/course/computer-architecture/chapter/data-representation ]
[ Copyright : Witspry @ 2020 ]
Digital computers store and process information in binary form as digital logic has only two values "1" and "0" or in other words "True or False" or
also said as "ON or OFF". This system is called radix 2. We human generally deal with radix 10 i.e. decimal. As a matter of convenience there are
many other representations like Octal (Radix 8), Hexadecimal (Radix 16), Binary coded decimal (BCD), Decimal etc.
Every computer's CPU has a width measured in terms of bits such as 8 bit CPU, 16 bit CPU, 32 bit CPU etc. Similarly, each memory location can store
a fixed number of bits and is called memory width. Given the size of the CPU and Memory, it is for the programmer to handle his data
representation. Most of the readers may be knowing that 4 bits form a Nibble, 8 bits form a byte. The word length is defined by the Instruction Set
Architecture of the CPU. The word length may be equal to the width of the CPU.
The memory simply stores information as a binary pattern of 1's and 0's. It is to be interpreted as what the content of a memory location means. If
the CPU is in the Fetch cycle, it interprets the fetched memory content to be instruction and decodes based on Instruction format. In the Execute
cycle, the information from memory is considered as data. As a common man using a computer, we think computers handle English or other
alphabets, special characters or numbers. A programmer considers memory content to be data types of the programming language he uses. Now
recall figure 1.2 and 1.3 of chapter 1 to reinforce your thought that conversion happens from computer user interface to internal representation and
storage.
Information handled by a computer is classified as instruction and data. A broad overview of the internal representation of the information is
illustrated in figure 3.1. No matter whether it is data in a numeric or non-numeric form or integer, everything is internally represented in Binary. It is
up to the programmer to handle the interpretation of the binary pattern and this interpretation is called Data Representation. These data
representation schemes are all standardized by international organizations.
Choice of Data representation to be used in a computer is decided by
The number types to be represented (integer, real, signed, unsigned, etc.)
Range of values likely to be represented (maximum and minimum to be represented)
The Precision of the numbers i.e. maximum accuracy of representation (floating point single precision, double precision etc)
If non-numeric i.e. character, character representation standard to be chosen. ASCII, EBCDIC, UTF are examples of character representation
standards.
The hardware support in terms of word width, instruction.
Figure.3.1 Typical Internal data representation types
Before we go into the details, let us take an example of interpretation. Say a byte in Memory has value "0011 0001". Although there exists a
possibility of so many interpretations as in figure 3.2, the program has only one interpretation as decided by the programmer and declared in the
program.
Figure.3.2 Data Interpretation
Fixed point numbers are also known as whole numbers or Integers. The number of bits used in representing the integer also implies the maximum
number that can be represented in the system hardware. However for the efficiency of storage and operations, one may choose to represent the
integer with one Byte, two Bytes, Four bytes or more. This space allocation is translated from the definition used by the programmer while defining a
variable as integer short or long and the Instruction Set Architecture.
In addition to the bit length definition for integers, we also have a choice to represent them as below:
Unsigned Integer: A positive number including zero can be represented in this format. All the allotted bits are utilised in defining the number.
So if one is using 8 bits to represent the unsigned integer, the range of values that can be represented is 28 i.e. "0" to "255". If 16 bits are used
for representing then the range is 216 i.e. "0 to 65535".
Signed Integer: In this format negative numbers, zero, and positive numbers can be represented. A sign bit indicates the magnitude direction
as positive or negative. There are three possible representations for signed integer and these are Sign Magnitude format, 1's Compliment
format and 2's Complement format.
Signed Integer – Sign Magnitude format: Most Significant Bit (MSB) is reserved for indicating the direction of the magnitude (value). A "0" on MSB
means a positive number and a "1" on MSB means a negative number. If n bits are used for representation, n-1 bits indicate the absolute value of
the number. Examples for n=8:
Examples for n=8:
0010 1111 = + 47 Decimal (Positive number)
1010 1111 = - 47 Decimal (Negative Number)
0111 1110 = +126 (Positive number)
1111 1110 = -126 (Negative Number)
0000 0000 = + 0 (Postive Number)
1000 0000 = - 0 (Negative Number)
Although this method is easy to understand, Sign Magnitude representation has several shortcomings like
Zero can be represented in two ways causing redundancy and confusion.
The total range for magnitude representation is limited to 2n-1, although n bits were accounted.
The separate sign bit makes the addition and subtraction more complicated. Also, comparing two numbers is not straightforward.
Signed Integer – 1’s Complement format: In this format too, MSB is reserved as the sign bit. But the difference is in representing the Magnitude part
of the value for negative numbers (magnitude) is inversed and hence called 1’s Complement form. The positive numbers are represented as it is in
binary. Let us see some examples to better our understanding.
Examples for n=8:
0010 1111 = + 47 Decimal (Positive number)
1101 0000 = - 47 Decimal (Negative Number)
0111 1110 = +126 (Positive number)
1000 0001 = -126 (Negative Number)
0000 0000 = + 0 (Postive Number)
1111 1111 = - 0 (Negative Number)
Step 1. -x = x' + 1 where x' is the one's complement of x.
Step 2 Extend the data width of the number, fill up with sign extension i.e. MSB bit is used to fill the bits.
Example: -47 decimal over 8bit representation
As you can see zero is not getting represented with redundancy. There is only one way of representing zero. The other problem of the complexity of
the arithmetic operation is also eliminated in 2’s complement representation. Subtraction is done as Addition.
More exercises on number conversion are left to the self-interest of readers.
The maximum number at best represented as a whole number is 2 . In the Scientific world, we do come across numbers like Mass of an Electron is
9.10939 x 10-31 Kg. Velocity of light is 2.99792458 x 108 m/s. Imagine to write the number in a piece of paper without exponent and converting into
binary for computer representation. Sure you are tired!!. It makes no sense to write a number in non- readable form or non- processible form. Hence
we write such large or small numbers using exponent and mantissa. This is said to be Floating Point representation or real number representation.
n
he real number system could have infinite values between 0 and 1.
Representation in computer
Unlike the two's complement representation for integer numbers, Floating Point number uses Sign and Magnitude representation for both mantissa
and exponent. In the number 9.10939 x 1031, in decimal form, +31 is Exponent, 9.10939 is known as Fraction. Mantissa, Significand and fraction are
synonymously used terms. In the computer, the representation is binary and the binary point is not fixed. For example, a number, say, 23.345 can be
written as 2.3345 x 101 or 0.23345 x 102 or 2334.5 x 10-2. The representation 2.3345 x 101 is said to be in normalised form.
Floating-point numbers usually use multiple words in memory as we need to allot a sign bit, few bits for exponent and many bits for mantissa. There
are standards for such allocation which we will see sooner.
We have two standards known as Single Precision and Double Precision from IEEE. These standards enable portability among different computers.
Figure 3.3 picturizes Single precision while figure 3.4 picturizes double precision. Single Precision uses 32bit format while double precision is 64 bits
word length. As the name suggests double precision can represent fractions with larger accuracy. In both the cases, MSB is sign bit for the mantissa
part, followed by Exponent and Mantissa. The exponent part has its sign bit.
Figure.3.3 IEEE 754 Single Precision Floating Point representation Standard
It is to be noted that in Single Precision, we can represent an exponent in the range -127 to +127. It is possible as a result of arithmetic operations
the resulting exponent may not fit in. This situation is called overflow in the case of positive exponent and underflow in the case of negative
exponent. The Double Precision format has 11 bits for exponent meaning a number as large as -1023 to 1023 can be represented. The programmer
has to make a choice between Single Precision and Double Precision declaration using his knowledge about the data being handled.
Figure 3.4 IEEE 754 Double Precision Floating Point representation Standard
The Floating Point operations on the regular CPU is very very slow. Generally, a special purpose CPU known as Co-processor is used. This Co-
processor works in tandem with the main CPU. The programmer should be using the float declaration only if his data is in real number form. Float
declaration is not to be used generously.
Decimal numbers (radix 10) are represented and processed in the system with the support of additional hardware. We deal with numbers in decimal
format in everyday life. Some machines implement decimal arithmetic too, like floating-point arithmetic hardware. In such a case, the CPU uses
decimal numbers in BCD (binary coded decimal) form and does BCD arithmetic operation. BCD operates on radix 10. This hardware operates without
conversion to pure binary. It uses a nibble to represent a number in packed BCD form. BCD operations require not only special hardware but also
decimal instruction set.
All of us know that when we do arithmetic operations, we get answers which have more digits than the operands (Ex: 8 x 2= 16). This happens in
computer arithmetic operations too. When the result size exceeds the allotted size of the variable or the register, it becomes an error and exception.
The exception conditions associated with numbers and number operations are Overflow, Underflow, Truncation, Rounding and Multiple Precision.
[ Credits : https://witscad.com/course/computer-architecture/chapter/data-representation ]
[ Copyright : Witspry @ 2020 ]
These are detected by the associated hardware in arithmetic Unit. These exceptions apply to both Fixed Point and Floating Point operations. Each of
these exceptional conditions has a flag bit assigned in the Processor Status Word (PSW). We may discuss more in detail in the later chapters.
Another data type is non-numeric and is largely character sets. We use a human-understandable character set to communicate with computer i.e. for
both input and output. Standard character sets like EBCDIC and ASCII are chosen to represent alphabets, numbers and special characters. Nowadays
Unicode standard is also in use for non-English language like Chinese, Hindi, Spanish, etc. These codes are accessible and available on the internet.
Interested readers may access and learn more.
WITSCAD
3 years ago 2 comments
Angular CLI or Angular
Command Line Interface is
2 years ago 2 comments
In this chapter, you will learn
about C# enumerations and
3 years ago 3 comments
If we call a language a high
level language, then it
3 years ago 2 comments
What are nested or child
components in Angular? A

More Related Content

What's hot (20)

Programming fundamentals lecture 4
Programming fundamentals lecture 4Programming fundamentals lecture 4
Programming fundamentals lecture 4
Raja Hamid
 
Problem Solving Techniques notes for Unit 1
Problem Solving Techniques notes for Unit 1Problem Solving Techniques notes for Unit 1
Problem Solving Techniques notes for Unit 1
SATHYABAMAMADHANKUMA
 
Building blocks of Algblocks of Alg.pptx
Building blocks of Algblocks of Alg.pptxBuilding blocks of Algblocks of Alg.pptx
Building blocks of Algblocks of Alg.pptx
NISHASOMSCS113
 
Language processors
Language processorsLanguage processors
Language processors
Ganesh Wedpathak
 
Deadlock Prevention in Operating System
Deadlock Prevention in Operating SystemDeadlock Prevention in Operating System
Deadlock Prevention in Operating System
Zeeshan Iqbal
 
Multiprocessor structures
Multiprocessor structuresMultiprocessor structures
Multiprocessor structures
Shareb Ismaeel
 
Concept of Pipelining
Concept of PipeliningConcept of Pipelining
Concept of Pipelining
SHAKOOR AB
 
Computer programming language generations
Computer programming language generationsComputer programming language generations
Computer programming language generations
MOHSIN BANGI
 
pipelining and hazards occure in assembly language.
pipelining and hazards occure in assembly language.pipelining and hazards occure in assembly language.
pipelining and hazards occure in assembly language.
Zohaib Arshid
 
Data transfer and manipulation
Data transfer and manipulationData transfer and manipulation
Data transfer and manipulation
rajshreemuthiah
 
Assembly language progarmming
Assembly language progarmmingAssembly language progarmming
Assembly language progarmming
Azmeyer
 
Assembly language programming
Assembly language programmingAssembly language programming
Assembly language programming
himhk
 
Unit 3-pipelining & vector processing
Unit 3-pipelining & vector processingUnit 3-pipelining & vector processing
Unit 3-pipelining & vector processing
vishal choudhary
 
The Phases of a Compiler
The Phases of a CompilerThe Phases of a Compiler
The Phases of a Compiler
Radhika Talaviya
 
Operating system notes pdf
Operating system notes pdfOperating system notes pdf
Operating system notes pdf
Jasleen Kaur (Chandigarh University)
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to C
Prabu U
 
instruction format.pptx
instruction format.pptxinstruction format.pptx
instruction format.pptx
AshokRachapalli1
 
Based and indexed addressing
Based and indexed addressingBased and indexed addressing
Based and indexed addressing
Javeria Yaqoob
 
Unit 1 computer architecture (1)
Unit 1   computer architecture (1)Unit 1   computer architecture (1)
Unit 1 computer architecture (1)
DevaKumari Vijay
 
Distributed system
Distributed systemDistributed system
Distributed system
Syed Zaid Irshad
 
Programming fundamentals lecture 4
Programming fundamentals lecture 4Programming fundamentals lecture 4
Programming fundamentals lecture 4
Raja Hamid
 
Problem Solving Techniques notes for Unit 1
Problem Solving Techniques notes for Unit 1Problem Solving Techniques notes for Unit 1
Problem Solving Techniques notes for Unit 1
SATHYABAMAMADHANKUMA
 
Building blocks of Algblocks of Alg.pptx
Building blocks of Algblocks of Alg.pptxBuilding blocks of Algblocks of Alg.pptx
Building blocks of Algblocks of Alg.pptx
NISHASOMSCS113
 
Deadlock Prevention in Operating System
Deadlock Prevention in Operating SystemDeadlock Prevention in Operating System
Deadlock Prevention in Operating System
Zeeshan Iqbal
 
Multiprocessor structures
Multiprocessor structuresMultiprocessor structures
Multiprocessor structures
Shareb Ismaeel
 
Concept of Pipelining
Concept of PipeliningConcept of Pipelining
Concept of Pipelining
SHAKOOR AB
 
Computer programming language generations
Computer programming language generationsComputer programming language generations
Computer programming language generations
MOHSIN BANGI
 
pipelining and hazards occure in assembly language.
pipelining and hazards occure in assembly language.pipelining and hazards occure in assembly language.
pipelining and hazards occure in assembly language.
Zohaib Arshid
 
Data transfer and manipulation
Data transfer and manipulationData transfer and manipulation
Data transfer and manipulation
rajshreemuthiah
 
Assembly language progarmming
Assembly language progarmmingAssembly language progarmming
Assembly language progarmming
Azmeyer
 
Assembly language programming
Assembly language programmingAssembly language programming
Assembly language programming
himhk
 
Unit 3-pipelining & vector processing
Unit 3-pipelining & vector processingUnit 3-pipelining & vector processing
Unit 3-pipelining & vector processing
vishal choudhary
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to C
Prabu U
 
Based and indexed addressing
Based and indexed addressingBased and indexed addressing
Based and indexed addressing
Javeria Yaqoob
 
Unit 1 computer architecture (1)
Unit 1   computer architecture (1)Unit 1   computer architecture (1)
Unit 1 computer architecture (1)
DevaKumari Vijay
 

Similar to Data representation computer architecture (20)

Unit 1 - Introduction to Digital Computer (computer organization.pdf
Unit 1 - Introduction to Digital Computer (computer organization.pdfUnit 1 - Introduction to Digital Computer (computer organization.pdf
Unit 1 - Introduction to Digital Computer (computer organization.pdf
chibunnajoe31
 
Lesson 1 basic theory of information
Lesson 1   basic theory of informationLesson 1   basic theory of information
Lesson 1 basic theory of information
Roma Kimberly Erolin
 
Lesson 1 basic theory of information
Lesson 1   basic theory of informationLesson 1   basic theory of information
Lesson 1 basic theory of information
Roma Kimberly Erolin
 
Data representation
 Data representation Data representation
Data representation
Ashraf Miraz
 
Module 2_Data representations.pdf
Module 2_Data representations.pdfModule 2_Data representations.pdf
Module 2_Data representations.pdf
Aditya kishore saxena
 
Representation of Integers
Representation of IntegersRepresentation of Integers
Representation of Integers
Susantha Herath
 
Counit2
Counit2Counit2
Counit2
Himanshu Dua
 
Topic 1 Data Representation
Topic 1 Data RepresentationTopic 1 Data Representation
Topic 1 Data Representation
Kyle
 
Topic 1 Data Representation
Topic 1 Data RepresentationTopic 1 Data Representation
Topic 1 Data Representation
ekul
 
3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt
RavikumarR77
 
Unit I-L1 - Basics of Digital Computer Organization and Architecture
Unit I-L1 - Basics of Digital Computer Organization and ArchitectureUnit I-L1 - Basics of Digital Computer Organization and Architecture
Unit I-L1 - Basics of Digital Computer Organization and Architecture
amanseerat89
 
Data Representation in Information Technology
Data Representation in Information TechnologyData Representation in Information Technology
Data Representation in Information Technology
JasperWaMagara
 
Chapter 02 Data Types
Chapter 02   Data TypesChapter 02   Data Types
Chapter 02 Data Types
Nathan Yeung
 
Lecture 7 Data Representation (1).pptx for computer organization and architec...
Lecture 7 Data Representation (1).pptx for computer organization and architec...Lecture 7 Data Representation (1).pptx for computer organization and architec...
Lecture 7 Data Representation (1).pptx for computer organization and architec...
nungogerald
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
vishal choudhary
 
Data Representation
Data RepresentationData Representation
Data Representation
Dilum Bandara
 
CS304PC:Computer Organization and Architecture Unit- III PDF notes .pdf
CS304PC:Computer Organization and Architecture Unit- III PDF notes .pdfCS304PC:Computer Organization and Architecture Unit- III PDF notes .pdf
CS304PC:Computer Organization and Architecture Unit- III PDF notes .pdf
Guru Nanak Technical Institutions
 
DigitalLogic_NumberRepresentation.pdf advanced
DigitalLogic_NumberRepresentation.pdf advancedDigitalLogic_NumberRepresentation.pdf advanced
DigitalLogic_NumberRepresentation.pdf advanced
mahajabeenakhtar8
 
Data storage (number,string,sound, image and video
Data storage (number,string,sound, image and videoData storage (number,string,sound, image and video
Data storage (number,string,sound, image and video
wafaashalash
 
chapter one && two.pdf
chapter one && two.pdfchapter one && two.pdf
chapter one && two.pdf
miftah88
 
Unit 1 - Introduction to Digital Computer (computer organization.pdf
Unit 1 - Introduction to Digital Computer (computer organization.pdfUnit 1 - Introduction to Digital Computer (computer organization.pdf
Unit 1 - Introduction to Digital Computer (computer organization.pdf
chibunnajoe31
 
Lesson 1 basic theory of information
Lesson 1   basic theory of informationLesson 1   basic theory of information
Lesson 1 basic theory of information
Roma Kimberly Erolin
 
Lesson 1 basic theory of information
Lesson 1   basic theory of informationLesson 1   basic theory of information
Lesson 1 basic theory of information
Roma Kimberly Erolin
 
Data representation
 Data representation Data representation
Data representation
Ashraf Miraz
 
Representation of Integers
Representation of IntegersRepresentation of Integers
Representation of Integers
Susantha Herath
 
Topic 1 Data Representation
Topic 1 Data RepresentationTopic 1 Data Representation
Topic 1 Data Representation
Kyle
 
Topic 1 Data Representation
Topic 1 Data RepresentationTopic 1 Data Representation
Topic 1 Data Representation
ekul
 
3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt
RavikumarR77
 
Unit I-L1 - Basics of Digital Computer Organization and Architecture
Unit I-L1 - Basics of Digital Computer Organization and ArchitectureUnit I-L1 - Basics of Digital Computer Organization and Architecture
Unit I-L1 - Basics of Digital Computer Organization and Architecture
amanseerat89
 
Data Representation in Information Technology
Data Representation in Information TechnologyData Representation in Information Technology
Data Representation in Information Technology
JasperWaMagara
 
Chapter 02 Data Types
Chapter 02   Data TypesChapter 02   Data Types
Chapter 02 Data Types
Nathan Yeung
 
Lecture 7 Data Representation (1).pptx for computer organization and architec...
Lecture 7 Data Representation (1).pptx for computer organization and architec...Lecture 7 Data Representation (1).pptx for computer organization and architec...
Lecture 7 Data Representation (1).pptx for computer organization and architec...
nungogerald
 
CS304PC:Computer Organization and Architecture Unit- III PDF notes .pdf
CS304PC:Computer Organization and Architecture Unit- III PDF notes .pdfCS304PC:Computer Organization and Architecture Unit- III PDF notes .pdf
CS304PC:Computer Organization and Architecture Unit- III PDF notes .pdf
Guru Nanak Technical Institutions
 
DigitalLogic_NumberRepresentation.pdf advanced
DigitalLogic_NumberRepresentation.pdf advancedDigitalLogic_NumberRepresentation.pdf advanced
DigitalLogic_NumberRepresentation.pdf advanced
mahajabeenakhtar8
 
Data storage (number,string,sound, image and video
Data storage (number,string,sound, image and videoData storage (number,string,sound, image and video
Data storage (number,string,sound, image and video
wafaashalash
 
chapter one && two.pdf
chapter one && two.pdfchapter one && two.pdf
chapter one && two.pdf
miftah88
 
Ad

Recently uploaded (20)

Présentation_gestion[1] [Autosaved].pptx
Présentation_gestion[1] [Autosaved].pptxPrésentation_gestion[1] [Autosaved].pptx
Présentation_gestion[1] [Autosaved].pptx
KHADIJAESSAKET
 
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
Journal of Soft Computing in Civil Engineering
 
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODSWIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
samueljackson3773
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) ProjectMontreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Alexandra N. Martinez
 
11th International Conference on Data Mining (DaMi 2025)
11th International Conference on Data Mining (DaMi 2025)11th International Conference on Data Mining (DaMi 2025)
11th International Conference on Data Mining (DaMi 2025)
kjim477n
 
New Microsoft Office Word Documentfrf.docx
New Microsoft Office Word Documentfrf.docxNew Microsoft Office Word Documentfrf.docx
New Microsoft Office Word Documentfrf.docx
misheetasah
 
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptxFINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
kippcam
 
David Boutry - Mentors Junior Developers
David Boutry - Mentors Junior DevelopersDavid Boutry - Mentors Junior Developers
David Boutry - Mentors Junior Developers
David Boutry
 
Airport_Substation_With_Diagrams (2).pptx
Airport_Substation_With_Diagrams (2).pptxAirport_Substation_With_Diagrams (2).pptx
Airport_Substation_With_Diagrams (2).pptx
BibekMedhi2
 
Strength of materials (Thermal stress and strain relationships)
Strength of materials (Thermal stress and strain relationships)Strength of materials (Thermal stress and strain relationships)
Strength of materials (Thermal stress and strain relationships)
pelumiadigun2006
 
Introduction to AI agent development with MCP
Introduction to AI agent development with MCPIntroduction to AI agent development with MCP
Introduction to AI agent development with MCP
Dori Waldman
 
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journeyRigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Yannis
 
IntroSlides-June-GDG-Cloud-Munich community [email protected]
IntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdfIntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdf
IntroSlides-June-GDG-Cloud-Munich community [email protected]
Luiz Carneiro
 
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdfRearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Takumi Amitani
 
Artificial Power 2025 raport krajobrazowy
Artificial Power 2025 raport krajobrazowyArtificial Power 2025 raport krajobrazowy
Artificial Power 2025 raport krajobrazowy
dominikamizerska1
 
Top Cite Articles- International Journal on Soft Computing, Artificial Intell...
Top Cite Articles- International Journal on Soft Computing, Artificial Intell...Top Cite Articles- International Journal on Soft Computing, Artificial Intell...
Top Cite Articles- International Journal on Soft Computing, Artificial Intell...
ijscai
 
SEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair KitSEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair Kit
projectultramechanix
 
Semi-Conductor ppt ShubhamSeSemi-Con.pptx
Semi-Conductor ppt ShubhamSeSemi-Con.pptxSemi-Conductor ppt ShubhamSeSemi-Con.pptx
Semi-Conductor ppt ShubhamSeSemi-Con.pptx
studyshubham18
 
Présentation_gestion[1] [Autosaved].pptx
Présentation_gestion[1] [Autosaved].pptxPrésentation_gestion[1] [Autosaved].pptx
Présentation_gestion[1] [Autosaved].pptx
KHADIJAESSAKET
 
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODSWIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
samueljackson3773
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) ProjectMontreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Alexandra N. Martinez
 
11th International Conference on Data Mining (DaMi 2025)
11th International Conference on Data Mining (DaMi 2025)11th International Conference on Data Mining (DaMi 2025)
11th International Conference on Data Mining (DaMi 2025)
kjim477n
 
New Microsoft Office Word Documentfrf.docx
New Microsoft Office Word Documentfrf.docxNew Microsoft Office Word Documentfrf.docx
New Microsoft Office Word Documentfrf.docx
misheetasah
 
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptxFINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
kippcam
 
David Boutry - Mentors Junior Developers
David Boutry - Mentors Junior DevelopersDavid Boutry - Mentors Junior Developers
David Boutry - Mentors Junior Developers
David Boutry
 
Airport_Substation_With_Diagrams (2).pptx
Airport_Substation_With_Diagrams (2).pptxAirport_Substation_With_Diagrams (2).pptx
Airport_Substation_With_Diagrams (2).pptx
BibekMedhi2
 
Strength of materials (Thermal stress and strain relationships)
Strength of materials (Thermal stress and strain relationships)Strength of materials (Thermal stress and strain relationships)
Strength of materials (Thermal stress and strain relationships)
pelumiadigun2006
 
Introduction to AI agent development with MCP
Introduction to AI agent development with MCPIntroduction to AI agent development with MCP
Introduction to AI agent development with MCP
Dori Waldman
 
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journeyRigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Yannis
 
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdfRearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Takumi Amitani
 
Artificial Power 2025 raport krajobrazowy
Artificial Power 2025 raport krajobrazowyArtificial Power 2025 raport krajobrazowy
Artificial Power 2025 raport krajobrazowy
dominikamizerska1
 
Top Cite Articles- International Journal on Soft Computing, Artificial Intell...
Top Cite Articles- International Journal on Soft Computing, Artificial Intell...Top Cite Articles- International Journal on Soft Computing, Artificial Intell...
Top Cite Articles- International Journal on Soft Computing, Artificial Intell...
ijscai
 
SEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair KitSEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair Kit
projectultramechanix
 
Semi-Conductor ppt ShubhamSeSemi-Con.pptx
Semi-Conductor ppt ShubhamSeSemi-Con.pptxSemi-Conductor ppt ShubhamSeSemi-Con.pptx
Semi-Conductor ppt ShubhamSeSemi-Con.pptx
studyshubham18
 
Ad

Data representation computer architecture

  • 1. TOC [ Credits : https://witscad.com/course/computer-architecture/chapter/data-representation ] [ Copyright : Witspry @ 2020 ] Digital computers store and process information in binary form as digital logic has only two values "1" and "0" or in other words "True or False" or also said as "ON or OFF". This system is called radix 2. We human generally deal with radix 10 i.e. decimal. As a matter of convenience there are many other representations like Octal (Radix 8), Hexadecimal (Radix 16), Binary coded decimal (BCD), Decimal etc. Every computer's CPU has a width measured in terms of bits such as 8 bit CPU, 16 bit CPU, 32 bit CPU etc. Similarly, each memory location can store a fixed number of bits and is called memory width. Given the size of the CPU and Memory, it is for the programmer to handle his data representation. Most of the readers may be knowing that 4 bits form a Nibble, 8 bits form a byte. The word length is defined by the Instruction Set Architecture of the CPU. The word length may be equal to the width of the CPU. The memory simply stores information as a binary pattern of 1's and 0's. It is to be interpreted as what the content of a memory location means. If the CPU is in the Fetch cycle, it interprets the fetched memory content to be instruction and decodes based on Instruction format. In the Execute cycle, the information from memory is considered as data. As a common man using a computer, we think computers handle English or other alphabets, special characters or numbers. A programmer considers memory content to be data types of the programming language he uses. Now recall figure 1.2 and 1.3 of chapter 1 to reinforce your thought that conversion happens from computer user interface to internal representation and storage. Information handled by a computer is classified as instruction and data. A broad overview of the internal representation of the information is illustrated in figure 3.1. No matter whether it is data in a numeric or non-numeric form or integer, everything is internally represented in Binary. It is up to the programmer to handle the interpretation of the binary pattern and this interpretation is called Data Representation. These data representation schemes are all standardized by international organizations. Choice of Data representation to be used in a computer is decided by The number types to be represented (integer, real, signed, unsigned, etc.) Range of values likely to be represented (maximum and minimum to be represented) The Precision of the numbers i.e. maximum accuracy of representation (floating point single precision, double precision etc) If non-numeric i.e. character, character representation standard to be chosen. ASCII, EBCDIC, UTF are examples of character representation standards. The hardware support in terms of word width, instruction.
  • 2. Figure.3.1 Typical Internal data representation types Before we go into the details, let us take an example of interpretation. Say a byte in Memory has value "0011 0001". Although there exists a possibility of so many interpretations as in figure 3.2, the program has only one interpretation as decided by the programmer and declared in the program. Figure.3.2 Data Interpretation Fixed point numbers are also known as whole numbers or Integers. The number of bits used in representing the integer also implies the maximum number that can be represented in the system hardware. However for the efficiency of storage and operations, one may choose to represent the integer with one Byte, two Bytes, Four bytes or more. This space allocation is translated from the definition used by the programmer while defining a variable as integer short or long and the Instruction Set Architecture. In addition to the bit length definition for integers, we also have a choice to represent them as below: Unsigned Integer: A positive number including zero can be represented in this format. All the allotted bits are utilised in defining the number. So if one is using 8 bits to represent the unsigned integer, the range of values that can be represented is 28 i.e. "0" to "255". If 16 bits are used for representing then the range is 216 i.e. "0 to 65535". Signed Integer: In this format negative numbers, zero, and positive numbers can be represented. A sign bit indicates the magnitude direction as positive or negative. There are three possible representations for signed integer and these are Sign Magnitude format, 1's Compliment format and 2's Complement format. Signed Integer – Sign Magnitude format: Most Significant Bit (MSB) is reserved for indicating the direction of the magnitude (value). A "0" on MSB means a positive number and a "1" on MSB means a negative number. If n bits are used for representation, n-1 bits indicate the absolute value of the number. Examples for n=8:
  • 3. Examples for n=8: 0010 1111 = + 47 Decimal (Positive number) 1010 1111 = - 47 Decimal (Negative Number) 0111 1110 = +126 (Positive number) 1111 1110 = -126 (Negative Number) 0000 0000 = + 0 (Postive Number) 1000 0000 = - 0 (Negative Number) Although this method is easy to understand, Sign Magnitude representation has several shortcomings like Zero can be represented in two ways causing redundancy and confusion. The total range for magnitude representation is limited to 2n-1, although n bits were accounted. The separate sign bit makes the addition and subtraction more complicated. Also, comparing two numbers is not straightforward. Signed Integer – 1’s Complement format: In this format too, MSB is reserved as the sign bit. But the difference is in representing the Magnitude part of the value for negative numbers (magnitude) is inversed and hence called 1’s Complement form. The positive numbers are represented as it is in binary. Let us see some examples to better our understanding. Examples for n=8: 0010 1111 = + 47 Decimal (Positive number) 1101 0000 = - 47 Decimal (Negative Number) 0111 1110 = +126 (Positive number) 1000 0001 = -126 (Negative Number) 0000 0000 = + 0 (Postive Number) 1111 1111 = - 0 (Negative Number) Step 1. -x = x' + 1 where x' is the one's complement of x. Step 2 Extend the data width of the number, fill up with sign extension i.e. MSB bit is used to fill the bits. Example: -47 decimal over 8bit representation As you can see zero is not getting represented with redundancy. There is only one way of representing zero. The other problem of the complexity of the arithmetic operation is also eliminated in 2’s complement representation. Subtraction is done as Addition. More exercises on number conversion are left to the self-interest of readers. The maximum number at best represented as a whole number is 2 . In the Scientific world, we do come across numbers like Mass of an Electron is 9.10939 x 10-31 Kg. Velocity of light is 2.99792458 x 108 m/s. Imagine to write the number in a piece of paper without exponent and converting into binary for computer representation. Sure you are tired!!. It makes no sense to write a number in non- readable form or non- processible form. Hence we write such large or small numbers using exponent and mantissa. This is said to be Floating Point representation or real number representation. n
  • 4. he real number system could have infinite values between 0 and 1. Representation in computer Unlike the two's complement representation for integer numbers, Floating Point number uses Sign and Magnitude representation for both mantissa and exponent. In the number 9.10939 x 1031, in decimal form, +31 is Exponent, 9.10939 is known as Fraction. Mantissa, Significand and fraction are synonymously used terms. In the computer, the representation is binary and the binary point is not fixed. For example, a number, say, 23.345 can be written as 2.3345 x 101 or 0.23345 x 102 or 2334.5 x 10-2. The representation 2.3345 x 101 is said to be in normalised form. Floating-point numbers usually use multiple words in memory as we need to allot a sign bit, few bits for exponent and many bits for mantissa. There are standards for such allocation which we will see sooner. We have two standards known as Single Precision and Double Precision from IEEE. These standards enable portability among different computers. Figure 3.3 picturizes Single precision while figure 3.4 picturizes double precision. Single Precision uses 32bit format while double precision is 64 bits word length. As the name suggests double precision can represent fractions with larger accuracy. In both the cases, MSB is sign bit for the mantissa part, followed by Exponent and Mantissa. The exponent part has its sign bit. Figure.3.3 IEEE 754 Single Precision Floating Point representation Standard It is to be noted that in Single Precision, we can represent an exponent in the range -127 to +127. It is possible as a result of arithmetic operations the resulting exponent may not fit in. This situation is called overflow in the case of positive exponent and underflow in the case of negative exponent. The Double Precision format has 11 bits for exponent meaning a number as large as -1023 to 1023 can be represented. The programmer has to make a choice between Single Precision and Double Precision declaration using his knowledge about the data being handled. Figure 3.4 IEEE 754 Double Precision Floating Point representation Standard The Floating Point operations on the regular CPU is very very slow. Generally, a special purpose CPU known as Co-processor is used. This Co- processor works in tandem with the main CPU. The programmer should be using the float declaration only if his data is in real number form. Float declaration is not to be used generously. Decimal numbers (radix 10) are represented and processed in the system with the support of additional hardware. We deal with numbers in decimal format in everyday life. Some machines implement decimal arithmetic too, like floating-point arithmetic hardware. In such a case, the CPU uses decimal numbers in BCD (binary coded decimal) form and does BCD arithmetic operation. BCD operates on radix 10. This hardware operates without conversion to pure binary. It uses a nibble to represent a number in packed BCD form. BCD operations require not only special hardware but also decimal instruction set. All of us know that when we do arithmetic operations, we get answers which have more digits than the operands (Ex: 8 x 2= 16). This happens in computer arithmetic operations too. When the result size exceeds the allotted size of the variable or the register, it becomes an error and exception. The exception conditions associated with numbers and number operations are Overflow, Underflow, Truncation, Rounding and Multiple Precision. [ Credits : https://witscad.com/course/computer-architecture/chapter/data-representation ] [ Copyright : Witspry @ 2020 ]
  • 5. These are detected by the associated hardware in arithmetic Unit. These exceptions apply to both Fixed Point and Floating Point operations. Each of these exceptional conditions has a flag bit assigned in the Processor Status Word (PSW). We may discuss more in detail in the later chapters. Another data type is non-numeric and is largely character sets. We use a human-understandable character set to communicate with computer i.e. for both input and output. Standard character sets like EBCDIC and ASCII are chosen to represent alphabets, numbers and special characters. Nowadays Unicode standard is also in use for non-English language like Chinese, Hindi, Spanish, etc. These codes are accessible and available on the internet. Interested readers may access and learn more. WITSCAD 3 years ago 2 comments Angular CLI or Angular Command Line Interface is 2 years ago 2 comments In this chapter, you will learn about C# enumerations and 3 years ago 3 comments If we call a language a high level language, then it 3 years ago 2 comments What are nested or child components in Angular? A