This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Floating poing 'non-bug'? Or is this a bug?


Yuval Kfir wrote:
The short program below gives '5*1.2=5' when compiled
without -DDOUBLE_INTER, but '5*1.2=6' with the double-precision intermediate
variable.

This is yet another instance of the "excess precision" problem. This is partly a problem with the x86 FPU design which provides only double-extended precision operations. And this is partly a problem with the design of the x86 gcc backend, which lies, and claims that we have float and double precision operations.


You should get the same result in both cases, but you get a different result for one because an intermediate value is written to the stack (fstpl) which rounds it to a double, and then loaded back (fldl). In the other case, the intermediate value is not written to the stack, and remains a double-extended value with excess precision.

This will probably only be fixed when the entire world switches to AMD AMD64 and/or Intel EM64T machines, and stops using x87 FP register-stack instructions.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]