In-depth understanding of computer system second exercise answers CSAPP 2.6, csapp2.6
By Printing bytes, we can know that the hexadecimal value of decimal number 12345 is 0x00003039, And the hexadecimal value of decimal floating point number 12345.0 is 0x4640E400.
Convert to binary
1 /*2 0 0 0 0 3 0 3 93 000000000000000000110000001110014 *************5 4 6 4 0 E 4 0 06 010001100100000011100100000000007 8 */
There are 13 matches after moving.
The hexadecimal value of decimal number 3510593 is 0x00359141, And the hexadecimal value of decimal floating point number 3510593.0 is 0x4a562134.
A. Write the binary representation of the above two numbers.
B. Move the relative positions of the two binary strings so that they match the most BITs. How many bits are matched?
C. The position in the string does not match.
1 /*2 0 0 3 5 9 1 4 13 000000000011010110010001010000014 *********************5 4 A 5 6 4 5 0 46 010010100101011001000101000001007 8 */
A.
1 /*2 0x003591413 0000 0000 0011 0101 1001 0001 0100 00014 5 0x4A5645046 0100 1010 0101 0110 0100 0101 0000 01007 */
B .21 match
C. intuitively: the first 9 and last 2 digits do not match the floating point number.
For integer numbers, the positions from the high to the 1st-bit non-0 do not match.
We will learn more about floating point storage later.