This is the mail archive of the
mailing list for the GCC project.
Re: Strange g+ 3.1.1 double behavior
Nathan Sidwell wrote:
Thank you for your answer. That explains how this problem occurs.
-float-store (-mfloat-store does not exist) does not help, but
|-mno-fp-ret-in-387 helps. Anyway, I will not use these options. Insted
I will get rid of my misconception that identical floating point
calculations yield identical results and |write my programs accordingly.
So thank you for explaining this to me as it may help to prevent future
grief that would have resulted from holding on to my misconception :-)
Not necesarily. floating point calculations can be performed at a
higher precision, and this happens on i86 hardware. IIRC the return value
will be in an i86 floating point register at 80 bits precision. One
return value must be stored on the stack (in a 64 bit double, hence
rounded), the other return value need not be, so is not rounded. The
result you see is the rounding error. This spilling of intermediates
at a lower precision is a quality of implementation thing.
-mfloat-store might help you here.