Data Representation
Data Representation
13 Dec 2020
Data Representation
2
Floating Point Number Representation
Consider a binary number 1101012 which
represents the value:
1 * 25 + 1 * 24 + 0 * 23 + 1 * 22 + 0* 21 + 1 * 20
= 32 + 16 + 4 + 1
= 5310
Divide the number 53 by 2, the result would be
26.5.
3
Floating Point Number Representation
Consider a binary number 1101012 which
represents the value:
1 * 25 + 1 * 24 + 0 * 23 + 1 * 22 + 0* 21 + 1 * 20
= 32 + 16 + 4 + 1
= 5310
Divide the number 53 by 2, the result would be
26.5.
How do we represent it if we only had integer
representations?
The key to represent fractional numbers, like
26.5 above, is the concept of binary point. A binary
point is like the decimal point in a decimal system. It
acts as a divider between the integer and the
fractional part of a number.
4
Floating Point Number Representation
In a decimal system, a decimal point denotes the
position in a numeral that the coefficient should
multiply by 100 = 1. For example, in the numeral
26.5, the coefficient 6 has a weight of 100 = 1.
8
Data Representation
Basic Formats
Figure 3.15 shows the fundamental division of
information into instructions (operation or control
words) and data (operands).
10
Data Representation
Information
Instruction Data
Fixed Point
Binary
Decimal
Floating Point
Binary
Decimal
12
Data Representation
Storage Order
A small but important aspect of data representaion is the
way in which the bits of a word are indexed as shown in
Fig.1, where the right-most bit is assigned the index 0
and the bits are labeled in increasing order from right to
left.
Byte 3 Byte 2 Byte 1 Byte 0
31………………….23………………..15………………….7………………….0
MSB LSB
Fig 1. Indexing convention for the bits and bytes of a word.
14
Data Representation
The alternative byte-storage scheme called little-endian
assigns the lowest address to byte 0. This corresponds
to
W0,W1,…Wm=B0,0,B0,1,B0,2,B0,3,B1,0,B1,1,B1,2,B1,3,….., Bm,0,Bm,1,Bm,2,Bm,3
15
Data Representation
Higher
….
….
address
...00C B3,3 ...00C B3,0
...00B B2,0 ...00B B2,3
...00A B2,1 ...00A B2,2
...02 ...02
...009 B2,2 ...009 B2,1
...008 B2,3 ...008 B2,0
….
…
...003 B0,0 ...003 B0,3
...002 B0,1 ...002 B0,2
...00 ...00
...001 B0,2 ...001 B0,1
Lower B0,0
...000 B0,3 address
...000
16