In: Computer Science
Convert 1.8125 to IEEE-754 representation. Show all your work.
1.8125
Converting 1.8125 to binary
Convert decimal part first, then the fractional
part
> First convert 1 to binary
Divide 1 successively by 2 until the quotient is
0
> 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 1
So, 1 of decimal is 1 in binary
> Now, Convert 0.81250000 to binary
> Multiply 0.81250000 with 2.
Since 1.62500000 is >= 1. then add 1 to
result
> Multiply 0.62500000 with 2.
Since 1.25000000 is >= 1. then add 1 to
result
> Multiply 0.25000000 with 2.
Since 0.50000000 is < 1. then add 0 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.8125 of decimal is .1101 in binary
so, 1.8125 in binary is 00000001.1101
1.8125 in simple binary => 1.1101
so, 1.8125 in normal binary is 1.1101 => 1.1101 *
2^0
single precision:
--------------------
sign bit is 0(+ve)
exponent bits are (127+0=127) => 01111111
Divide 127 successively by 2 until the quotient is
0
> 127/2 = 63, remainder is
1
> 63/2 = 31, remainder is
1
> 31/2 = 15, remainder is
1
> 15/2 = 7, remainder is 1
> 7/2 = 3, remainder is 1
> 3/2 = 1, remainder is 1
> 1/2 = 0, remainder is 1
Read remainders from the bottom to top as
1111111
So, 127 of decimal is 1111111 in binary
frac/significant bits are 11010000000000000000000
so, 1.8125 in single-precision format is 0 01111111
11010000000000000000000
Hexadecimal Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
Use this table to convert from binary to hexadecimal
Converting 00111111111010000000000000000000 to hexadecimal
0011 => 3
1111 => F
1110 => E
1000 => 8
0000 => 0
0000 => 0
0000 => 0
0000 => 0
So, in hexadecimal 00111111111010000000000000000000 is
0x3FE80000
in hexadecimal it is 0x3FE80000