In: Computer Science
Write the IEEE floating point representation (single precision) of 3.75 (Show all your steps to get full credit).
Converting 3.75 to binary
Convert decimal part first, then the fractional part
> First convert 3 to binary
Divide 3 successively by 2 until the quotient is 0
> 3/2 = 1, remainder is 1
> 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 11
So, 3 of decimal is 11 in binary
> Now, Convert 0.75 to binary
> Multiply 0.75 with 2. Since 1.5 is >= 1. then add 1 to result
> Multiply 0.5 with 2. Since 1.0 is >= 1. then add 1 to result
> This is equal to 1, so, stop calculating
0.75 of decimal is .11 in binary
so, 3.75 in binary is 11.11
3.75 in simple binary => 11.11
so, 3.75 in normal binary is 11.11 => 1.111 * 2^1
single precision:
--------------------
sign bit is 0(+ve)
exp bits are (127+1=128) => 10000000
Divide 128 successively by 2 until the quotient is 0
> 128/2 = 64, remainder is 0
> 64/2 = 32, remainder is 0
> 32/2 = 16, remainder is 0
> 16/2 = 8, remainder is 0
> 8/2 = 4, remainder is 0
> 4/2 = 2, remainder is 0
> 2/2 = 1, remainder is 0
> 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 10000000
So, 128 of decimal is 10000000 in binary
frac bits are 11100000000000000000000
so, 3.75 in single-precision format is 0 10000000 11100000000000000000000
in hexadecimal it is 0x40700000