Re: Optimization and double comparison

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2008-08-05 at 10:19 +0200, Torquil Macdonald Sørensen wrote:
> On Tuesday 5. August 2008 00:20, Brian Dessent wrote:
> >
> > Much has already been written on this topic, so I suggest just reading
> > PR323 or googling.  There are numerous workarounds: use sse2 instead of
> > 387, set the 387 to double precision (e.g. -mpc64 or _FP_{GET,SET}CW),
> > use -ffloat-store, don't compare for absolute equality but against some
> > small delta, etc.
> >
> > Brian
> 
> Hi Brian, thank you very much. Yes the target is x86. Your answer was very 
> interesting. The comparison was just to make sure that a certain quantity 
> still had the value that it is supposed to have, so it was only for debugging 
> my algorithm. It should be allright if I instead allow a small error in the 
> comparison, so I think that I don't have to worry about this problem then.

You may wish to at least note that the default for 32-bit compile is
x87, but for 64-bit it is SSE2. As Brian noted, x87 uses 80-bit
internally, but SSE2 uses only 64-bit.

Somebody down the road may port this to 64-bit and get different
results. (In my experience, the "somebody down the road" may be myself,
and I've forgotten why I did something. :) )

Bob



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux