On Sunday, 30 September 2012 at 06:20:56 UTC, jerro wrote:
The second one uses fstp twice, then fld twice. I don't know, maybe
this could be a bug.

You're right the lack of one fst/fld in the first case is a bug. x87 floating point registers are 80 bit. This:

fstp    dword [ebp-0CH]

Converts the value in ST0 to single precision float and stores it to memory (and pops ST0). When it is later loaded with fld, it is not the same as before storing since some precision is lost (because the D code compares floats and not reals, this is the correct behavior). In the first example, this storing and loading only happens for the first function call. For the second call the value is returned in ST0 and stays in x87 registers until it is compared with fucompp so it is not truncated as the result of the first function call was. That's why the compared values are not equal.

Can you or anyone report this bug? I don't know how to do this.

Reply via email to