From: Petr Savicky <savicky@cs.cas.cz>
To: gcc-help@gcc.gnu.org
Subject: option -ffloat-store has no effect
Date: Sat, 03 Dec 2005 00:35:00 -0000 [thread overview]
Message-ID: <20051203003524.GA30737@cs.cas.cz> (raw)
Dear gcc-help,
the option -ffloat-store has no effect on the following program.
If the program
#include <stdio.h>
double a,i,x;
int main(int argc, char *argv[])
{
a = 1;
for (i=1; i<100; i++) {
x = i*(a/i);
if (x != (i*(a/i))) printf("%f\n",i);
}
}
is compiled with gcc -O0 -ffloat-store
or with gcc -O0 -fno-float-store,
then the obtained binary executable program is the same (verified by diff)
and produces the output
41.000000
45.000000
55.000000
61.000000
82.000000
90.000000
99.000000
So, there are two questions:
1. Why -ffloat-store has no effect?
2. Is there some other option needed to guarantee that after
double a,i,x;
...
x = i*(a/i);
the test
(x == i*(a/i))
is satisfied?
I use Fedora Core release 2 on Xeon processor.
gcc (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
Thank you in advance for any help.
Petr
next reply other threads:[~2005-12-03 0:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-03 0:35 Petr Savicky [this message]
2005-12-03 0:53 Nelson H. F. Beebe
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=20051203003524.GA30737@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).