Thanks for the quick response. I have altered my code so that it does not depend on the way extended precision is handled. It gives the right answer no mater how it is compiled.
I guess the moral is: don't try to check for exact equality between two double precision numbers that have been calculated because one may be in memory and the other may be stored with extra precision in registers (in which case they will never come out equal). Is that a fair way to understand the behavior of g77/gcc/the CPU/the FPU? Steve On Tue, 26 Oct 2004, Andrew Pinski wrote: > > On Oct 26, 2004, at 3:01 PM, Steven E. Williamson wrote: > > > Two other symptoms that I have noticed: if the -ffloat-store option is > > used, then the program always works correctly (does only 2 iterations). > > And, if the write statement immediately preceding the check for > > equal averages is un-commented, the program also works correctly. > > There you said how to fix your problem -ffloat-store. The point is that > gcc (and g77) is using the additional precision which you are not > expecting > to be used. I am going to assume you are on x86 where this problem > comes > up all the time. > > Thanks, > Andrew Pinski >