public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Petr Savicky <savicky@cs.cas.cz>
To: gcc-help@gcc.gnu.org
Subject: where to discuss problems with IEEE 754 standard on x86 architecture?
Date: Tue, 22 May 2007 20:05:00 -0000	[thread overview]
Message-ID: <20070522194435.GC29083@cs.cas.cz> (raw)

Can anybody help me to find the right place to discuss the problems
related to IEEE 754 standard for floating point numbers on x86 (IA-32)?

The following code
  #include <stdio.h>
  
  int main(int argc, char *argv[]) {
      double x,y,z,m=1.0;
      for (int i=0; i<52; i++) { m *= 2.0; }
  
      x = 1.5 - 1.0/4096.0 - 1.0/m;
      y = 1.5 - 1.0/4096.0;
  
      z = 1.0 + 1.0/m*x;
      printf("%f\n",m*(z-1.0));
  
      z = 1.0 + 1.0/m*y;
      printf("%f\n",m*(z-1.0));
  }
produces output
  1.000000
  2.000000
on x86 (IA-32) processor. In my opinion, this implies that IA-32 processor
does not follow IEEE 754 exactly, since the closest representable
value to both 1.0 + 1.0/m*x and 1.0 + 1.0/m*y is z = 1.0 + 1.0/m
and not z = 1.0 + 2.0/m, which is obtained in the second case.

Am I right? If yes, I think that the problem is known. Are there web
pages or other resources on this problem?

Thank you very much for any information.

All the best, Petr.

             reply	other threads:[~2007-05-22 19:45 UTC|newest]

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

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=20070522194435.GC29083@cs.cas.cz \
    --to=savicky@cs.cas.cz \
    --cc=gcc-help@gcc.gnu.org \
    /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).