In: Computer Science
a) (15/2) * 2^50
First convert the number to binary. Here is an example how to do the conversion. Rest of the conversions can be done similarly.
(15/2) = 7.5
(7)10 = (111)2
(0.5)10 = (0.1)2
(15/2) * 2^50 = (111.1) * 250 = (1.111) * 252 [Since the base is 2]
Thus exponent , e = 52
In single precision,
exponent, e' = e+127 = 52+127 = 179 = (10110011)2
Mantissa:- .11100000000000000000000 [Since mantissa is 23 bits in ieee 754 single precision]
Also the number is positive. So sign bit = 0.
Final representation:- 0 10110011 11100000000000000000000 [32 bit]
In double precision,
exponent, e' = e+1023 = 52+1023 = 1075 = (1000110011)2 [11 bits]
Mantissa:- .1110000000000000000000000000000000000000000000000000 [Since mantissa is 52 bits in ieee 754 double precision]
Also the number is positive. So sign bit = 0.
Final representation:- 0 1000110011 1110000000000000000000000000000000000000000000000000 [64 bit]
b) (-15/2) * (2^-50)
15/2 = 7.5 = (111.1)2
(-15/2) * (2^-50) = (111.1)*2-50 = (1.111)*2-48
In single precision,
exponent, e' = e+127 = -48+127 = 79 = (01001111)2
Mantissa:- .11100000000000000000000 [Since mantissa is 23 bits in ieee 754 single precision]
Also the number is negative. So sign bit = 1.
Final representation:- 1 01001111 11100000000000000000000 [32 bit]
In double precision,
exponent, e' = e+1023 = -48+1023 = 975 = (01111001111)2 [11 bits]
Mantissa:- .1110000000000000000000000000000000000000000000000000 [Since mantissa is 52 bits in ieee 754 double precision]
Also the number is negative. So sign bit = 1.
Final representation:- 1 01111001111 1110000000000000000000000000000000000000000000000000 [64 bit]
c) 1/5 = 0.2
= (0.2)10 = (0.0011...)2
Convert to normal form:- 1.10011001100110011... * 2-3
In single precision,
exponent, e' = e+127 = -3+127 = 124 = (01111010)2
Mantissa:- .10011001100110011001100 [Since mantissa is 23 bits in ieee 754 single precision]
Also the number is positive. So sign bit = 0.
Final representation:- 0 01111010 10011001100110011001100 [32 bit]
In double precision,
exponent, e' = e+1023 = -3+1023 = 1020 = (01111111100)2 [11 bits]
Mantissa:- .1001100110011001100110011001100110011001100110011001 [Since mantissa is 52 bits in ieee 754 double precision]
Also the number is positive. So sign bit = 0.
Final representation:- 0 01111111100 1001100110011001100110011001100110011001100110011001 [64 bit]