This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: floating point: weird behaviour of gcc-2.95
- From: Tim Prince <timothyprince at sbcglobal dot net>
- To: juggy at gmx dot net, gcc-bugs at gcc dot gnu dot org
- Date: Thu, 16 Jan 2003 20:07:30 -0800
- Subject: Re: floating point: weird behaviour of gcc-2.95
- References: <3E27E921.9040404@gmx.net>
- Reply-to: tprince at computer dot org
On Friday 17 January 2003 03:29, juggy@gmx.net wrote:
> Hi there,
>
> I recently noticed an odd behaviour of gcc. I searched the archives, but
> I didn't find anything that really looks like this.
> I am currently writing software that must be as numerically stable as
> possible. Now the problem is that on Linux-Machines with gcc-2.95.3 and
> gcc-2.95.4 (I didn't have other versions to check) using the switch -O2
> results in inaccuracies (i.e. a double variable never becomes 0) whilst
> -O1 is still alright.
> At first I thought I might be using the switches in a wrong way, but
> when I checked on a FreeBSD system (gcc-2.95.3) with the exactly same
> program and the same switches it worked fine. I also tried switches like
> -fno-fast-math and such, but none seemed to solve the problem.
> Afterwards I checked with gcc-3.2.1, and everything worked fine with -O2.
> Maybe I am missing something about using the correct switches, but I
> think it is very odd that gcc on BSD and gcc on Linux show this
> different a behaviour. I'd really appreciate if anyone could elighten me
> on this issue.
>
If you're testing to see whether x87 operations are carried out in 53-bit
precision mode, why not say so? No, there's no switch to pass to linux
run-time libraries to change precision mode, but you could use the asm()
functions. WIth gcc-3.2.1, you do have switches to select x87, SSE, or SSE2
code generation, so you can control precision of intermediate operations that
way. If you've truly come across something which isn't in the archives, you
certainly haven't bothered to explain it.
--
Tim Prince