MASTER OF COMPUTER APPLICATIONS
Course Code : MCS-012
Course Title : Computer Organisation and Assembly Language Programming
Assignment Number : MCA (2)/012/Assign /2014-15
Maximum Marks : 100
Weightage : 25%
Explain the single precision floating point single IEEE 754 representation. Represent the number (63.125)10 using IEEE 754 single precision and double precision representations.
Single Precision
S stands for Sign (white color)
E stands for Exponent (yellow color)
N stands for Number (also called Mantissa or Significand) (green color)
0this Sign bit (1 bit)
1st to 8this Exponent bits (7 bits)
9thto 31this Exponent bits (24 bits)
Double Precision
S stands for Sign (white color)
E stands for Exponent (yellow color)
N stands for Number (also called Mantissa or Significand) (green color)
0this Sign bit (1 bit)
1st to 11this Exponent bits (10 bits)
12thto 63this Exponent bits (53 bits)
First of all to represent we have (63.125)10 using IEEE 754
Since number is a positive number
Sign bit is: 0
0 |
Now let’s work on Mantissa part
Convert 63 into binary form i.e 11111
Remaining is fraction part 0.125
Now we multiply fraction value with 2 till we get whole number 1 at the end.
We reach 1 so we stop
Write number from top to bottom
We get 0.125 = 001
Number (63.125)10 = (11111.001)2
Convert Binary number to Exponent Form
11111.001 Will be 1.1111001 * 24
Discard 1.
Take 1111001 as Significand
Significand number = (1111001)2
Significand bits are:
1 | 1 | 1 | 1 | 0 | 0 | 1 |
Fill the Significand in the beginning
Rest all fills it with 0’s
We will have
Significand bits are:
1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
+4 is the Exponent
So we have to subtract it with 127
Exponent = 127+4=130
Exponent number (130)10 = (10000010)2
Discard overflow bit
Exponent bits are:
0 | 0 | 0 | 0 | 0 | 1 | 0 |
Note: we have to discard overflow bit since we have only 7 bits
For Double Precision Only Exponent
+4 is the Exponent
So we have to subtract it with 1023
Exponent = 1023+4=1027
Exponent number (1027)10 = (10000000011)2
Discard overflow bit
Exponent bits are:
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
Note: we have to discard overflow bit since we have only 11 bits
Significand bits are:
1 | 1 | 1 | 1 | 0 | 0 | 1 |
Significand will only have a change in terms of Zero’s which are added at the end.
For single precision 23-7=16 Zero’s
For double precision 53-7=46 Zero’s