In: Computer Science
Convert 103.375 into double precision floating format
show all steps and explanations
Converting 103.375 to binary
Convert decimal part first, then the fractional part
> First convert 103 to binary
Divide 103 successively by 2 until the quotient is 0
> 103/2 = 51, remainder is 1
> 51/2 = 25, remainder is 1
> 25/2 = 12, remainder is 1
> 12/2 = 6, remainder is 0
> 6/2 = 3, remainder is 0
> 3/2 = 1, remainder is 1
> 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 1100111
So, 103 of decimal is 1100111 in binary
> Now, Convert 0.37500000 to binary
> Multiply 0.37500000 with 2. Since 0.75000000 is < 1. then add 0 to result
> Multiply 0.75000000 with 2. Since 1.50000000 is >= 1. then add 1 to result
> Multiply 0.50000000 with 2. Since 1.00000000 is >= 1. then add 1 to result
> This is equal to 1, so, stop calculating
0.375 of decimal is .011 in binary
so, 103.375 in binary is 1100111.011
103.375 in simple binary => 1100111.011
so, 103.375 in normal binary is 1100111.011 => 1.100111011 * 2^6
single precision:
--------------------
sign bit is 0(+ve)
exp bits are (1023+6=1029) => 10000000101
Divide 1029 successively by 2 until the quotient is 0
> 1029/2 = 514, remainder is 1
> 514/2 = 257, remainder is 0
> 257/2 = 128, remainder is 1
> 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 10000000101
So, 1029 of decimal is 10000000101 in binary
frac bits are 1001110110000000000000000000000000000000000000000000
so, 103.375 in single-precision format is 0 10000000101 1001110110000000000000000000000000000000000000000000
in hexadecimal it is 0x4059D80000000000