numerical results differ after irrelevant code change

Robert Dewar dewar@adacore.com
Sun May 8 17:02:00 GMT 2011


On 5/8/2011 12:48 PM, Michael D. Berger wrote:

> I made the changes you suggest.  While I was previously getting
> -1.16e-16 and -1.03e-16 depending presence of an "extra"
> class member, I now get 1.11e-16 (sic not -).  But it is now independent of
> the extra class member, which is excellent.  Hopefully, things will stay
> that way.

This is a fairly big change to make in your program, since it
completely alters the fpt semantics, but probably in a desirable
way. Sounds like you don't have any real careful analysis of the
reliability of the results or needed precision anyway, you just
don't like the non-repeatability, and indeed the change to
restrict the precision to 64-bits should work to solve that
problem.



More information about the Gcc mailing list