Module 2 Data Representation
Part 1
Dr. Bhanu Chander Balusa
Sr. Assistant Professor ,SCOPE
VIT Chennai
1
2
3
Numeric Data Representation
Numbers System
Positional Number Non positional
system Numbers System
Binary
decimal
octal
Hexadecimal
4
5
Data
Representation
Fixed Point Floating point
Representation representation
6
7
Number
representation
Only for positive numbers For both positive and negative numbers
Unsigned Signed
representation representaion
Signed magnitude 1’s complement 2’s complement
Form form form
8
Signed Numbers
Example: +8 and -8 in 7 bit-binary number representation
represent +8 ==> 0 001000
ways to represent -8 :
signed-magnitude: 1 001000
signed-1's complement: 1 110111
signed-2's complement: 1 111000
9
Signed Numbers
Example: -2.5
represent -2.5 ==> 1 10.1
ways to represent -2.5 :
signed-magnitude: 1 10.1
signed-1's complement: 1 01.0
signed-2's complement: 1 01.1
10
11
Single Precision
32bits
8 bits 23 bits
Exponent Fraction
Sign
(1 bit)
64 bits
Double 11 bits 52bits
Precision Exponent Fraction
12
13
Floating-Point Representation
Show the IEEE 754 binary representation of the number 0.75 in single
and double precision.
The number 0.75 is also
3/4 or 3/22
It is also represented by the binary fraction
-11/22 or -0.11
In scientific notation, the value is
-0.11 X 20
14
Floating-Point Representation
and in normalized scientific notation, it is
-1.1 X 2 -1
The general representation for a single precision number is
(-1)s X (1+Fraction) X 2 (Exponent – 127)
-0.75 can be represented as -(0.11)
15
16
17
The general representation for a double precision number is
(-1)s X (1+Fraction) X 2 (Exponent – 1023)
Computer Arithmetic
18
19
Floating Point addition and
subtraction
Compare the magnitudes of the two exponents and make the
proper shifting of bits to the number with the smaller magnitude
of the exponent
Perform addition/subtraction
Perform normalization by shifting the resulting mantissa and
adjust the resulting exponent
20
21
22
23
24
25
26
Floating Point Multiplication
Step 1: Normalize the values
Step : Add the exponents without bias or with bias
Step 3: Multiply the significands
Step 4: check the result is normalized or not and check the exponent
for overflow or underflow
Step 5: if the sign of two given values is different then put the sign
for the result binary value
27
28