public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nick Maclaren <nmm1@cus.cam.ac.uk>
To: gcc-help@gcc.gnu.org
Cc: Petr Savicky <savicky@cs.cas.cz>
Subject: Re: where to discuss problems with IEEE 754 standard on x86 architecture?
Date: Wed, 23 May 2007 08:17:00 -0000	[thread overview]
Message-ID: <E1HqlVp-00070d-AH@draco.cus.cam.ac.uk> (raw)
In-Reply-To: Your message of "Wed, 23 May 2007 09:08:51 +0200."              <20070523070851.GA2951@cs.cas.cz>

> > You were using -mfpmath=387 (possible as the default), and that uses
> > Intel native arithmetic, which is NOT standard IEEE 754 double, but
> > an extended format.
> > 
> > If you use -mfpmath=sse, you will get what you expect.
> 
> Thank you for your reply. This explains the problem.
> 
> However, solving the problem seems to be harder.
> I tried "gcc -mfpmath=sse", but obtained the warning:
>  SSE instruction set disabled, using 387 arithmetics.

I have never discovered a gcc switch to enable 'proper' IEEE 754
arithmetic.  -ffloat-store does something, at the expense of slowing
down code.

There are reasons for this.  IEEE 754 is a hardware specification and,
in over 20 years, has neve been supported by programming languages.
The IEEE 754 fanatics claim that it is the language and compiler
people being uncooperative, but it really is due to the fact that
the IEEE 754 standard is very unsuitable for implementing in any
high-level language I know of.  It also has major numerical RAS
flaws, but that's another matter.

C99 has taken in on board, but is a complete crock, and only Sun
(and POSSIBLY some Microsoft-only compilers) support that aspect.

You should learn how to write numeric code that is independent of
the arithmetic, which will also usually make it more robust.  That
is what we used to do 30+ years ago, when there was a LOT more
variation than there is today.


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1@cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679

  reply	other threads:[~2007-05-23  7:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-22 20:41 Nick Maclaren
2007-05-23  7:44 ` Petr Savicky
2007-05-23  8:17   ` Nick Maclaren [this message]
2007-05-23  8:46   ` Brian Dessent
2007-05-23 13:30   ` Tim Prince
2007-05-23 17:23     ` Petr Savicky
  -- strict thread matches above, loose matches on Subject: below --
2007-05-22 20:25 Nick Maclaren
2007-05-22 20:05 Petr Savicky
2007-05-22 20:06 ` John (Eljay) Love-Jensen
2007-05-23 12:54 ` Andrew Haley

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=E1HqlVp-00070d-AH@draco.cus.cam.ac.uk \
    --to=nmm1@cus.cam.ac.uk \
    --cc=gcc-help@gcc.gnu.org \
    --cc=savicky@cs.cas.cz \
    /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).