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]

Re: optimization problem with 1.0.3


>> I'm not sure what to make of this problem.  This simple program
>> behaves differently when compiled with or without optimization.
>
>This is a side effect of the Intel floating point hardware.
>A double is 64 bits.  The internal floating point registers are 80
>bits.  1.0/3.0 has no exact binary representation.  This means that

Thanks for the explanation.

I have to say this makes me a little bit uncomfortable, though.
You'd think (f(x)==f(x)) would always be true if f has no internal state,
but it turns out that it still depends on the details of f, and it depends
on whether optimization is on, and it depends on whether you are running
on Intel.  Even if (1.0==1.0) is taken to be always false, at least 
(1.0-1.0)<precision is true for some small number 'precision', but the same
cannot be said for f(x)-f(x) which can diverge uncontrollably.

But I guess this is no longer an egcs question...  Again, thanks for the 
help.


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