Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "David McClain" <dmcclain@azstarnet.com>
To: <caml-list@inria.fr>
Subject: Correct interpretation of the Pentium non-bug
Date: Fri, 3 Sep 1999 11:17:33 -0700	[thread overview]
Message-ID: <000e01bef638$98d32b10$210148bf@dylan> (raw)

Something Xavier showed got me thinking and I ran some more tests this
morning. It turns out that the problem previously reported actually has
nothing to do with FCHS vs FSUB. Rather, it has to do with how one adds a
real value to a complex value, especially when the complex value has a
IEEE(-0.0) imaginary component.

Adding a real to a complex number:

    a + (bre, bim)   !=  (a+bre, bim)

rather

    a + (bre, bim) == (a + bre, (+0.0) + bim)

This matters only when bim is (-0.0) because,

    FPADD (+0.0) (+0.0) = +0.0
    FPADD (+0.0) (-0.0)  = +0.0     (!!!)
    FAPDD (+0.0) x         =  x          (for all other x)

When this is properly handled, the routines all give the correct branch cut
behavior. It turns out that, indeed, I*(are, aim) = (- aim, are)  where the
negative sign is FCHS, instead of (0.0 - aim, are).  The second form is
incorrect.

While all very esoteric and nit-picking, it does show the importance in
compiler writing of being very careful during constant-folding and
strength-reduction phases of optimization. I am probably guilty, years ago,
of assuming that 0.0 + anything => anything, in my old C compilers. This
subtle fact simply isn't true in IEEE FP.

- DM





                 reply	other threads:[~1999-09-06  8:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='000e01bef638$98d32b10$210148bf@dylan' \
    --to=dmcclain@azstarnet.com \
    --cc=caml-list@inria.fr \
    /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