public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bob Plantz <plantz@cds1.net>
To: "Torquil Macdonald Sørensen" <torquil@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Optimization and double comparison
Date: Tue, 05 Aug 2008 15:22:00 -0000	[thread overview]
Message-ID: <1217949715.6022.7.camel@bob-desktop> (raw)
In-Reply-To: <200808051019.13789.torquil@gmail.com>

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


      reply	other threads:[~2008-08-05 15:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-04 21:41 Torquil Macdonald Sørensen
2008-08-04 22:21 ` Brian Dessent
2008-08-05  8:19   ` Torquil Macdonald Sørensen
2008-08-05 15:22     ` Bob Plantz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1217949715.6022.7.camel@bob-desktop \
    --to=plantz@cds1.net \
    --cc=gcc-help@gcc.gnu.org \
    --cc=torquil@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).