SlideShare a Scribd company logo
Data Representation -
Part I
Representing Numbers
 Choosing an appropriate representation is
a critical decision a computer designer has
to make
 The chosen representation must allow for
efficient execution of primitive operations
 For general-purpose computers, the
representation must allow efficient
algorithms for
 (1) addition of two integers
 (2) determination of additive inverse
 With a sequence of N bits, there are 2N
unique representations
 Each memory cell can hold N bits
 The size of the memory cell determines
the number of unique values that can be
represented
 The cost of performing operations also
increases as the size of the memory cell
increases
 It is reasonable to select a memory cell
size such that numbers that are frequently
used are represented
Binary Representation
 The binary, weighted positional notation is
the natural way to represent non-negative
numbers
 SAL and MAL number the bits from right to
left, i.e., beginning with 0 as the least
significant digit
Little-Endian vs. Big-Endian
 Numbering the bits from right to left,
beginning with zero is called Little Endian
byte order. Intel 80x86 and DECstation 3100
use the Little Endian byte ordering.
 Numbering the bits from left to right,
beginning with zero is called Big Endian byte
order. SunSparc and Macintosh use the Big-
Endian byte ordering.
Representation of Integers
 Unsigned Integer Representation
 Sign Magnitude
 Complement Representation
 Biased Representation
 Sign Extension
Unsigned Integer
Representation
 The representation of a non-negative integer
using binary, weighted positional notation is
called unsigned integer representation
 Given n bits, it is possible to represent the
range of values from 0 to 2n
- 1
 For example an 8-bit representation would
allow representations that range 0 to 255
Sign Magnitude
 An extra bit in the most significant position is
designated as the sign bit which is to the left
of an unsigned integer. The unsigned integer
is the magnitude.
 A 0 in the sign bit means positive, and a 1
means negative
xxx xxxx
x
 Given an n+1-bit sign magnitude number
the range of values that it can represent is
-(2n
-1) to +(2n
-1)
 Sign magnitude representation associates
a sign bit with a magnitude that represents
zero, thus it has two distinct representation
of zero:
00000000 and 10000000
sign bit magnitude
Complement Representation
 For positive integers, the representation is
the same as for sign magnitude
 For negative numbers, a large bias is
added to all negative numbers, creating
positive numbers in unsigned
representation
 The bias is chosen so that any negative
number representable appears as if it were
larger than the largest positive number
representable
One’s Complement
 For positive numbers, the representation is
the same as for unsigned integers where
the most significant bit is always zero
 The additive inverse of a one’s
complement representation is found by
inverting each bit.
 Inverting each bit is also called taking the
one’s complement
Example 9.1
0000 0011 (3)
1111 1100 (-3)
1110 1000 (-23)
0001 0111 (23)
0000 0000 (0)
1111 1111 (0)
Note: There are two
representations of zero
Two’s complement
 The additive inverse of a two’s
complement integer can be obtained by
adding 1 to its one’s complement
 The two’s complement representation for a
negative number is the additive inverse of
its positive representation
 An advantage of two’s complement is that
there is only one representation for zero
Example 9.2
010001 (17) 1101000 (-24)
101110 0010111
1 1
------ -------
101111 (-17) 0011000 (24)
take the 1’s complement
 In two’s complement, one more negative
value than positive value is represented - the
most negative number has no additive
inverse within a fixed precision.
 For example, 1000000 has no additive
inverse for 8-bit precision. Taking the two’s
complement will yield 1000000 which seems
its own additive inverse. This is incorrect and
is an example of an overflow.
 Note that computing the additive inverse is a
mathematical operation. Taking the
complement is an operation on the
representation.
Biased Representation
 If the unsigned representation includes
integers from 0 to M, then subtracting
approximately M/2 from the unsigned
interpretation would shift the range from
-(M/2) to +(M/2)
 If a sequence has a value N when
interpreted as an unsigned integer, it has a
value N-bias interpreted as a biased number
 Usually the bias is either 2n
or 2n
-1 for an
(n+1)bit representation
Example 9.3
Assume a 3-bit representation. A possible bias
is 2n-1
, which is 4. The following is a 3-bit
representation with a bias of 4.
bit pattern integer represented
(in decimal)
000 -4
001 -3
010 -2
011 -1
100 0
101 1
110 2
111 3
Example 9.4
Given 0000 0110, what is it’s value in a
biased-127 representation. Assume an
8-bit representation.
The value of the unsigned integer:
0000 0110 = 610
Its value in biased-127 is:
6 - 127 = -121
Sign Extension
 For integer representations, the sizes are
commonly 8, 16, 32 and 64.
 It is occasionally necessary to convert an
integer representation from one size to
another, e.g., from 8 bits to 32 bits.
 The point is to maintain the same value while
changing the size of the representation
Sign Extension - Unsigned
 Place the original integer into the least
significant portion and stuff the remaining
positions with 0’s.
xxxxxxxx
00000000xxxxxxxx
8 bits
16 bits
Sign Extension - Signed
 The sign bit of the smaller representation
is placed into the sign bit of the larger
representation
 The magnitude is put into the least
significant portion and all remaining
positions are stuffed with 0’s.
sxxxxxxx
s00000000xxxxxxx
Sign Extension - complement
 For positive number, a 0 is used to stuff
the remaining positions.
 For negative number, a 1 is used to stuff
the remaining positions.
0xxxxxxx
000000000xxxxxxx
1xxxxxxx
111111111xxxxxxx
The original number is
placed into the least
significant portion
The original number is
placed into the least
significant portion

More Related Content

PPT
3.Fixed-Floating Point.ppt
PDF
DigitalLogic_NumberRepresentation.pdf advanced
PPT
Data storage (number,string,sound, image and video
PDF
Chapter 4
PDF
Data representation computer architecture
PDF
Notes unit 2
PPTX
Representation of Integers
PDF
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)
3.Fixed-Floating Point.ppt
DigitalLogic_NumberRepresentation.pdf advanced
Data storage (number,string,sound, image and video
Chapter 4
Data representation computer architecture
Notes unit 2
Representation of Integers
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)

Similar to Data Representation in Information Technology (20)

PPT
Lecture 3
PDF
Module 2_Data representations.pdf
DOCX
Data representation
PPT
Mba admission in india
PPT
Ch02_4web456489478465165489445156568.ppt
PPTX
Representation of Signed Numbers - R.D.Sivakumar
PPTX
Data Representation
PPT
Number system and codes
PPTX
DE -gxgxhxydydydfyfduffuf UEEB02 - L 7.pptx
PPT
Mba admission in india
PPT
Counit2
PPTX
UNIT 4 -Data Representation.pptxfghfghhggh
PPTX
Signed and Unsigned Numbers and Complement - Copy.pptx
PPT
Lesson 1 basic theory of information
PPT
Lesson 1 basic theory of information
PPTX
Chapter_Two.pptx data representation in computer
PPTX
Chapter_02_The_Language_of_Bits_Any.pptx
PPTX
module 1_class_numbers.pptx
PPTX
CH10-COA10e.pptx
PPTX
Data Reprersentation
Lecture 3
Module 2_Data representations.pdf
Data representation
Mba admission in india
Ch02_4web456489478465165489445156568.ppt
Representation of Signed Numbers - R.D.Sivakumar
Data Representation
Number system and codes
DE -gxgxhxydydydfyfduffuf UEEB02 - L 7.pptx
Mba admission in india
Counit2
UNIT 4 -Data Representation.pptxfghfghhggh
Signed and Unsigned Numbers and Complement - Copy.pptx
Lesson 1 basic theory of information
Lesson 1 basic theory of information
Chapter_Two.pptx data representation in computer
Chapter_02_The_Language_of_Bits_Any.pptx
module 1_class_numbers.pptx
CH10-COA10e.pptx
Data Reprersentation
Ad

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PPTX
Big Data Technologies - Introduction.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
cuic standard and advanced reporting.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
KodekX | Application Modernization Development
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Spectroscopy.pptx food analysis technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Encapsulation theory and applications.pdf
PPTX
Cloud computing and distributed systems.
Machine learning based COVID-19 study performance prediction
Big Data Technologies - Introduction.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Reach Out and Touch Someone: Haptics and Empathic Computing
cuic standard and advanced reporting.pdf
Spectral efficient network and resource selection model in 5G networks
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
sap open course for s4hana steps from ECC to s4
Understanding_Digital_Forensics_Presentation.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Unlocking AI with Model Context Protocol (MCP)
Diabetes mellitus diagnosis method based random forest with bat algorithm
KodekX | Application Modernization Development
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Spectroscopy.pptx food analysis technology
Chapter 3 Spatial Domain Image Processing.pdf
Encapsulation theory and applications.pdf
Cloud computing and distributed systems.
Ad

Data Representation in Information Technology

  • 2. Representing Numbers  Choosing an appropriate representation is a critical decision a computer designer has to make  The chosen representation must allow for efficient execution of primitive operations  For general-purpose computers, the representation must allow efficient algorithms for  (1) addition of two integers  (2) determination of additive inverse
  • 3.  With a sequence of N bits, there are 2N unique representations  Each memory cell can hold N bits  The size of the memory cell determines the number of unique values that can be represented  The cost of performing operations also increases as the size of the memory cell increases  It is reasonable to select a memory cell size such that numbers that are frequently used are represented
  • 4. Binary Representation  The binary, weighted positional notation is the natural way to represent non-negative numbers  SAL and MAL number the bits from right to left, i.e., beginning with 0 as the least significant digit
  • 5. Little-Endian vs. Big-Endian  Numbering the bits from right to left, beginning with zero is called Little Endian byte order. Intel 80x86 and DECstation 3100 use the Little Endian byte ordering.  Numbering the bits from left to right, beginning with zero is called Big Endian byte order. SunSparc and Macintosh use the Big- Endian byte ordering.
  • 6. Representation of Integers  Unsigned Integer Representation  Sign Magnitude  Complement Representation  Biased Representation  Sign Extension
  • 7. Unsigned Integer Representation  The representation of a non-negative integer using binary, weighted positional notation is called unsigned integer representation  Given n bits, it is possible to represent the range of values from 0 to 2n - 1  For example an 8-bit representation would allow representations that range 0 to 255
  • 8. Sign Magnitude  An extra bit in the most significant position is designated as the sign bit which is to the left of an unsigned integer. The unsigned integer is the magnitude.  A 0 in the sign bit means positive, and a 1 means negative xxx xxxx x
  • 9.  Given an n+1-bit sign magnitude number the range of values that it can represent is -(2n -1) to +(2n -1)  Sign magnitude representation associates a sign bit with a magnitude that represents zero, thus it has two distinct representation of zero: 00000000 and 10000000 sign bit magnitude
  • 10. Complement Representation  For positive integers, the representation is the same as for sign magnitude  For negative numbers, a large bias is added to all negative numbers, creating positive numbers in unsigned representation  The bias is chosen so that any negative number representable appears as if it were larger than the largest positive number representable
  • 11. One’s Complement  For positive numbers, the representation is the same as for unsigned integers where the most significant bit is always zero  The additive inverse of a one’s complement representation is found by inverting each bit.  Inverting each bit is also called taking the one’s complement
  • 12. Example 9.1 0000 0011 (3) 1111 1100 (-3) 1110 1000 (-23) 0001 0111 (23) 0000 0000 (0) 1111 1111 (0) Note: There are two representations of zero
  • 13. Two’s complement  The additive inverse of a two’s complement integer can be obtained by adding 1 to its one’s complement  The two’s complement representation for a negative number is the additive inverse of its positive representation  An advantage of two’s complement is that there is only one representation for zero
  • 14. Example 9.2 010001 (17) 1101000 (-24) 101110 0010111 1 1 ------ ------- 101111 (-17) 0011000 (24) take the 1’s complement
  • 15.  In two’s complement, one more negative value than positive value is represented - the most negative number has no additive inverse within a fixed precision.  For example, 1000000 has no additive inverse for 8-bit precision. Taking the two’s complement will yield 1000000 which seems its own additive inverse. This is incorrect and is an example of an overflow.  Note that computing the additive inverse is a mathematical operation. Taking the complement is an operation on the representation.
  • 16. Biased Representation  If the unsigned representation includes integers from 0 to M, then subtracting approximately M/2 from the unsigned interpretation would shift the range from -(M/2) to +(M/2)  If a sequence has a value N when interpreted as an unsigned integer, it has a value N-bias interpreted as a biased number  Usually the bias is either 2n or 2n -1 for an (n+1)bit representation
  • 17. Example 9.3 Assume a 3-bit representation. A possible bias is 2n-1 , which is 4. The following is a 3-bit representation with a bias of 4. bit pattern integer represented (in decimal) 000 -4 001 -3 010 -2 011 -1 100 0 101 1 110 2 111 3
  • 18. Example 9.4 Given 0000 0110, what is it’s value in a biased-127 representation. Assume an 8-bit representation. The value of the unsigned integer: 0000 0110 = 610 Its value in biased-127 is: 6 - 127 = -121
  • 19. Sign Extension  For integer representations, the sizes are commonly 8, 16, 32 and 64.  It is occasionally necessary to convert an integer representation from one size to another, e.g., from 8 bits to 32 bits.  The point is to maintain the same value while changing the size of the representation
  • 20. Sign Extension - Unsigned  Place the original integer into the least significant portion and stuff the remaining positions with 0’s. xxxxxxxx 00000000xxxxxxxx 8 bits 16 bits
  • 21. Sign Extension - Signed  The sign bit of the smaller representation is placed into the sign bit of the larger representation  The magnitude is put into the least significant portion and all remaining positions are stuffed with 0’s. sxxxxxxx s00000000xxxxxxx
  • 22. Sign Extension - complement  For positive number, a 0 is used to stuff the remaining positions.  For negative number, a 1 is used to stuff the remaining positions. 0xxxxxxx 000000000xxxxxxx 1xxxxxxx 111111111xxxxxxx The original number is placed into the least significant portion The original number is placed into the least significant portion