For example: Float value is 12345.0
Bit representation on little endian machine: 00E44046
Actual Bit representation is : 4640E400
Bit representation: 01000110010000001110010000000000
Float interpretation: sign 1 bit, exponent 8 bits, fraction 23 bits.
Sign Exponent Fraction
0 10001100 10000001110010000000000
Decimal
value 140 4252672/2^23
Use normal interpretation:
E = 140-(2^(8-1)-1)
(1 + 4252672/2^23)*(2^(140-(2^(8-1)-1)))
2^23 = 8388608;
140-(2^(8-1)-1) = 13;
(1 + 4252672/2^23) = 1.5069580078125
(2^(140-(2^(8-1)-1))) = 8192
(1 + 4252672/2^23)*(2^(140-(2^(8-1)-1))) = 1.5069580078125 * 8192 = 12345
--
Happy day, happy life!
No comments:
Post a Comment