You can use print bytes to know that the hexadecimal number of decimal 12345 is 0x00003039, and the hexadecimal of decimal floating point 12345.0 is 0x4640e400.
Convert to Binary to
1 /* 2 0 0 0 0 3 0 3 93 0000000000000000001 10000001110014 *************5 4 6 4 0 E 4 0 06 010001100100000011100100000000007 8* /
There are 13-bit matches after the move.
The hexadecimal of the known decimal number 3510593 is 0x00359141, and the hexadecimal of decimal floating point 3510593.0 is 0x4a564504.
A. Write a binary representation of the two numbers above.
B. Move the relative positions of the two binary strings so that they match the largest number of digits. How many matches are there?
C. What position in the string does not match.
1/*2 0 0 3 5 9 1 4 13 00000000001 1010110010001010000014 *********************5 4 A 5 6 4 5 0 46 010010100 101011001000101000001 0 0 7 8 */
A.
1 /* 2 0x00359141 3 0000 0000 0011 0101 1001 0001 0100 0001 4 5 0x4a564504 6 0100 1010 0101 0110 0100 0101 0000 0100 7 */
B. 21-bit matching
C. Intuitively: The first 9 digits and the last 2 bits do not match the floating point number.
Does not match the position of the integer number from the high to the 1th bit not 0.
Follow-up understanding of floating point storage is more straightforward.
In-depth understanding of computer system Second Edition exercise solution Csapp 2.6