In: Computer Science
Solution:
Given,
=>IEEE 754 floating point representation is used.
=>Decimal number = -0.25
(a)
Explanation:
Single precision frame format:
Sign(S) | Exponent(E) | Mantissa(M) |
1 bit 8 bits 23 bits
=>Normalized form = (-1)^S*(1.M)*2^(E-127)
Converting decimal number to binary from:
=>(-0.25)10 = (-0.01)2
Converting number in normalized form:
=>Number in normalized form = (-1)^1*(1.00000000000000000000000)*2^-2
=>S = 1
=>E - 127 = -2
=>E = 125 in decimal
=>E = 01111101 in binary
=>M = 00000000000000000000000
=>Hence number single precision = 10111110100000000000000000000000
(b)
Explanation:
Double precision frame format:
Sign(S) | Exponent(E) | Mantissa(M) |
1 bit 11 bits 52 bits
=>Normalized form = (-1)^S*(1.M)*2^(E - 1023)
=>(-0.25)10 = (-0.01)2
Converting number in normalized form:
=>Number in normalized form = (-1)^1*(1.0000000000000000000000000000000000000000000000000000)*2^-2
=>S = 1
=>E - 1023 = -2
=>E = 1021 in decimal
=>E = 01111111101 in binary
=>M = 0000000000000000000000000000000000000000000000000000
=>Hence number in double precision = 1011111111010000000000000000000000000000000000000000000000000000
I have explained each and every part with the help of statements attached to the answer above.