Recently, a floating-point problem has been encountered,
Code:
FLD DWORD ptr ds:[esi+1e4]
and esi+1e4 = 02fce9d4,
Here is his memory:
02fce9d4 C0 2B C0 2B 45 00 00 00 00 00 00 00 00.? E.? E........
And after execution, ST0 = 2748.00000000000
I want to know how ST0 is equal to 2748?
The analysis is as follows:
After all, the problem of floating-point composition, according to the IEEE Standard, the first bit is the sign bit, then the 8bit is the exponent, the remaining 23bit is the bottom digit, considering the small end storage, the value of the number of C0 2B 45 is 452bc000, that is:
0100 0101 0010 1011 1100 0000 0000 0000
The first bit is 0, which indicates a positive number,
The subsequent 8bit, which is 10001010, 8 A, is converted to decimal 138, 138-127 = 11, indicating that the exponent is 11 bits
The remaining 23-bit values are: 010 1011 1100 0000 0000 0000, the first bit is padded with omitted 1, and the value is:
1010 1011 1100 0000 0000 0000, exponent 11-bit description, the position of the decimal point is:
1010 1011 1100. 0000 0000 0000, converted to 16 in abc.000, converted to 10, which is 2748.00000000
A tangled floating-point problem