Reputation: 3
Eight consecutive bytes in memory contain the hex values 00, 00, 00, 00, 00, 64, 9E, 40. An FLD m64fp instruction is executed. Its argument is the address of the first of these eight consecutive bytes. As a result of the FLD instruction, the value in ST(0) is now:
1) 1776.0
2) 1945.0
3) 2003.0
4) 1984.0
If someone could please explain to me how to go about this question, how exactly I can solve it, & what you think the answer might be as I am very very lost.
Thanks for the input.
Upvotes: 0
Views: 1002
Reputation: 5597
FLD loads a float into the stack. Because you're executing FLD m64fp it will load those 8 bytes (64-bit floating-point) in little-endian format into the stack. Therefore to work out ST(0) we can use the following code:
Java:
System.out.println(Double.longBitsToDouble(0x409E640000000000L));
C:
uint64_t u2 = 0x409E640000000000L;
printf("%lf\n", *((double*)&u2));
Which outputs 1945.0
Upvotes: 2