public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "npr1 at suomi24 dot fi" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/16607] Incorrect FP code generated in member data initialization
Date: Mon, 19 Jul 2004 14:40:00 -0000	[thread overview]
Message-ID: <20040719143958.30085.qmail@sourceware.org> (raw)
In-Reply-To: <20040717172049.16607.npr1@suomi24.fi>


------- Additional Comments From npr1 at suomi24 dot fi  2004-07-19 14:39 -------
Personally, I don't mind floats being imprecise in the last few bits, or doubles 
being imprecise in their last few bits. What I do mind is that after assigning 
float * float to double, that double value can have "simultaneously" two values 
that differ in almost half of their last bits. If this is allowed, one can never 
count on double having any more practical precision than float, especially with 
the duality being carried over [inlined] function calls. I'm sure many programs 
rely on this but, since it's broken so rarely it's not noticed until with a new 
compiler or a small non-related change in code structure. (Ouch!)

The "double = float * float" case could be fixed without performance issues, 
too. The compiler could well generate code that always uses the value with extra 
precision (that of double, or more). As I noted, the compiler already does this 
in all cases but the one. At least in my example, using two forms (single and 
double precision) of the result generates an unnecessary instruction, so 
actually there would be a performance increase.

I suppose a compiler patch could be too laborious compared to the gains, 
especially as it mustn't affect non-x86 compilations. My personal fix will be 
converting all uses of float to double, but obviously this is not good for all 
programs.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16607


      parent reply	other threads:[~2004-07-19 14:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-17 17:20 [Bug c++/16607] New: " npr1 at suomi24 dot fi
2004-07-17 17:40 ` [Bug c++/16607] " pinskia at gcc dot gnu dot org
2004-07-17 20:41 ` npr1 at suomi24 dot fi
2004-07-17 22:29 ` pinskia at gcc dot gnu dot org
2004-07-18  0:38 ` npr1 at suomi24 dot fi
2004-07-19  2:01 ` npr1 at suomi24 dot fi
2004-07-19  2:58 ` npr1 at suomi24 dot fi
2004-07-19  3:22 ` zack at gcc dot gnu dot org
2004-07-19 14:40 ` npr1 at suomi24 dot fi [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=20040719143958.30085.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).